Opened 14 years ago
Closed 13 years ago
#1903 closed defect (fixed)
OLPC-Calculate Activity – Cannot enter negative values to the entry box.
Reported by: | Niranjala80 | Owned by: | rwh |
---|---|---|---|
Priority: | Normal | Milestone: | Unspecified |
Component: | Calculate | Version: | Unspecified |
Severity: | Minor | Keywords: | |
Cc: | Distribution/OS: | Unspecified | |
Bug Status: | New |
Description
Description:
Press (-) to begin a new number entry after a previous calculation was done.
For instance,
User enters the following to the entry box.
1+2
The answer, User got is:
3
Click on the entry box.
Press negative (-) sign.
It displayed as 3- on the entry box.
The entry box should display the negative sign.
Steps to recreate the defect:
Precondition
User should be in the Calculator Activity
- Power on OLPC
- Click on the calculate icon on home page.
- Enter whatever calculation to the entry box.
- Click on Entry button.
- Get the result on the right side box.
- Click on entry box
- Press negative sign (-).
- Verify the displayed value on the entry box.
Actual Result:
Cannot enter negative values to the entry box and user enters, it is displaying the value as follows in the entry box. (Previous calculation result used.)
Eg: 3-
Expected Result:
Entry of negative number should be allowed and it should display properly in the entry box.
Tested Environment:
OS Build: OS 13
Machine Type: XO 1.0
Firmware: Q2E42
Security Disable: Yes
Sugar Version: 0.84.14
Activity Version: 30
Change History (3)
comment:1 Changed 14 years ago by quozl
comment:2 Changed 13 years ago by garycmartin
- Distribution/OS changed from Other (name your distribution in the description) to Unspecified
- Keywords OS13 removed
- Version changed from 0.84.x to Unspecified
I believe this is a feature (tested in Calculate-30). You can type a sequence of equations picking up the previous result. Any operator can be used, though I agree that the - operator is one you might more commonly use and not want this behaviour (user is forced to type something 0-3 if they actually want -3 as the first number in an equation). Probably only solution is to loose this feature as clicking an answer already inserts it into the equation for similar functionality.
comment:3 Changed 13 years ago by garycmartin
- Resolution set to fixed
- Status changed from new to closed
Reinier committed a patch in git, should be in Calculate-32 once released. The minus symbol no longer pulls in the previous answer (however other operators like *+/ still do). Seems a bit of s sneaky patch, but it does at least resolve this specific use case.
Reproduced on XO-1.5 using same activity version.
Diagnosis:
The minus key used for entering the negative sign is also a mathematical operator key, and the meaning is thus overloaded. In astparser.py the character "-" is in both the DIADIC_OPS and PRE_OPS.
In calculate.py, when characters typed are being processed, which is in function button_pressed where type is set to TYPE_TEXT, the following code appears:
The check of PRE_OPS is commented out. This may relate.