Merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-fix1295944 into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Bartosz Kosiorek
Status: Merged
Approved by: Mihir Soni
Approved revision: 239
Merged at revision: 242
Proposed branch: lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-fix1295944
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 29 lines (+3/-8)
1 file modified
formula.js (+3/-8)
To merge this branch: bzr merge lp:~gang65/ubuntu-calculator-app/ubuntu-calculator-fix1295944
Reviewer Review Type Date Requested Status
Mihir Soni Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Bartosz Kosiorek Needs Information
Victor Thompson (community) Approve
Review via email: mp+212310@code.launchpad.net

Commit message

Fix problems with calculations such as "1+=", "1/=", 1*=", and 1-=" (LP:1295944)

Description of the change

Fix problems with calculations such as "1+=", "1/=", 1*=", and 1-=" (LP:1295944)

To post a comment you must log in.
Revision history for this message
Victor Thompson (vthompson) wrote :

I did not test for regressions, but this fixes the bug and retains the behavior discussed in the bug comments.

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Hi,

I see, you are putting same as result, instead of that we should display message :- Malformed expression or Error.

review: Needs Fixing
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Thanks Mihir for comment.

If we display "error" then it will be very hard to fix that wrong calculation.
"Backspace" will not working, and all you could do is delete whole calculation. The user should have start calculation from scratch
My idea is that when you have wrong formula, you could fix that.

If you have some long formula: "3467+423423+423423+234234+23874+="
With Error message implementation, you can't fix that. You need clear all formula and retype whole formula.
With current implementation you could use "backspace".

review: Needs Information
239. By Bartosz Kosiorek

Sync with trunk

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

This looks good to merge. @mihir, all good for you too?

review: Approve
Revision history for this message
Mihir Soni (mihirsoni) wrote :

Looks good to me as well.

Thanks Bartosz

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'formula.js'
2--- formula.js 2014-03-03 23:51:23 +0000
3+++ formula.js 2014-04-26 15:51:03 +0000
4@@ -205,14 +205,9 @@
5 formula = '(' + formula + ')' + table[secondLast.type] + last.value.toString();
6 }
7 // In this case user press a number, and operator (or only an operator, if it isn't the first calc), and then equal
8- else if (last.type & T_OPERATOR){
9- //If user is trying to use same numbers
10- if(formula.length === 2) {
11- formulaPush(secondLast.value.toString())
12- }
13+ else if (last.type & T_OPERATOR) {
14 //if user has not put any number after last sign then ignore it
15- else
16- formulaPop()
17+ formulaPop()
18 }
19 result = _calculate(formula);
20
21@@ -227,7 +222,7 @@
22 return result;
23 }
24
25- this.changeSign = function(){
26+ this.changeSign = function() {
27 // If user want to change the sign of the result
28 // previous.type is 16 if user do a calc, press equal, press a sign, press c and then press +/-
29 if (isLastResult || previous.type === 16) {

Subscribers

People subscribed via source and target branches