Merge lp:~mihirsoni/ubuntu-calculator-app/1226738 into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk

Proposed by Mihir Soni
Status: Merged
Approved by: Riccardo Padovani
Approved revision: 164
Merged at revision: 165
Proposed branch: lp:~mihirsoni/ubuntu-calculator-app/1226738
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 22 lines (+9/-3)
1 file modified
formula.js (+9/-3)
To merge this branch: bzr merge lp:~mihirsoni/ubuntu-calculator-app/1226738
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+188024@code.launchpad.net

Commit message

corrected output of the calculation

Description of the change

This change include following updates :-
if user press 9*= it'll do the the multiplication with last number.
if user press 9+= it'll do the addition with the last number

Above behavior is related to bug #1203435 which we haven't removed it.

If user press 9*5-= calculator will ignore the last sign and will calculate the result as 40. Solution of bug #1226738

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
164. By Mihir Soni

modified the indetation

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Looks good to me :)
Thanks for the work Mihir!

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 2013-09-24 19:29:44 +0000
3+++ formula.js 2013-09-28 08:47:43 +0000
4@@ -158,9 +158,15 @@
5 if (isLastResult && !isChangeSign && table[secondLast.type] !== undefined)
6 formula = '(' + formula + ')' + table[secondLast.type] + last.value.toString();
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- formula = formula + secondLast.value.toString();
10-
11+ else if (last.type & T_OPERATOR){
12+ //If user is trying to use same numbers
13+ if(formula.length === 2) {
14+ formulaPush(secondLast.value.toString())
15+ }
16+ //if user has not put any number after last sign then ignore it
17+ else
18+ formulaPop()
19+ }
20 result = _calculate(formula);
21
22 // If user want to change sign to the result

Subscribers

People subscribed via source and target branches