Code review comment for lp:~rpadovani/ubuntu-calculator-app/fix-database

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

In rev 140 was introduct a critical bug in DB storage[1]:
the Storage.saveCalculations was designed to save all calculations when the app was closed, so the function has an argoument (calculations) that is an array with all calculations.

After rev 140 the Storage.saveCalculations is called at every tearOff, so every time all array is saved.

If I put a console.log in Storage.saveCalculations that logs every time is called and the lenght of var calculations, and I do a calc, tear off, do a calc, tear off again and close the app, in rev 139 I have:
calculationCompleted
save
calc length 2

in rev 140 I have:
calculationCompleted
save
calc length1
newPush
calculationCompleted
save
calc length2

After my changes, the calc is saved every time, but the calculations array has only last calc, so we have not multiple calc saved.

[1]http://bazaar.launchpad.net/~ubuntu-calculator-dev/ubuntu-calculator-app/trunk/revision/140

« Back to merge proposal