← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~fboucault/ubuntu-calculator-app/fix_parenthesis into lp:ubuntu-calculator-app

 

Florian Boucault has proposed merging lp:~fboucault/ubuntu-calculator-app/fix_parenthesis into lp:ubuntu-calculator-app.

Commit message:
Fix regression caused by startup time optimisation: could not close parentheses anylonger.

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)
Related bugs:
  Bug #1616270 in Ubuntu Calculator App: "Cannot close parenthesis"
  https://bugs.launchpad.net/ubuntu-calculator-app/+bug/1616270

For more details, see:
https://code.launchpad.net/~fboucault/ubuntu-calculator-app/fix_parenthesis/+merge/304254

Fix regression caused by startup time optimisation: could not close parentheses anylonger.
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~fboucault/ubuntu-calculator-app/fix_parenthesis into lp:ubuntu-calculator-app.
=== modified file 'app/engine/formula.js'
--- app/engine/formula.js	2016-07-27 13:13:29 +0000
+++ app/engine/formula.js	2016-08-29 13:31:25 +0000
@@ -130,8 +130,8 @@
     }
 
     // Calculate how many brackets are opened
-    var numberOfOpenedBrackets = (longFormula.match(/\(/g) || []).length -
-                                (longFormula.match(/\)/g) || []).length;
+    var numberOfOpenedBrackets = (formulaToCheck.match(/\(/g) || []).length -
+                                (formulaToCheck.match(/\)/g) || []).length;
 
     if (numberOfOpenedBrackets < 1) {
         return false;
@@ -150,7 +150,7 @@
     if (formulaToCheck === '') {
         return "(";
     }
-    var lastChar = longFormula.substring(formulaToCheck.length - 1, formulaToCheck.length);
+    var lastChar = formulaToCheck.substring(formulaToCheck.length - 1, formulaToCheck.length);
 
     if (isNaN(lastChar) && lastChar !== ")" && lastChar !== "i" && lastChar !== "E"  && lastChar !== "!") {
         return "(";


Follow ups