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

Proposed by Mihir Soni
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 142
Merged at revision: 140
Proposed branch: lp:~mihirsoni/ubuntu-calculator-app/1188292
Merge into: lp:~ubuntu-calculator-dev/ubuntu-calculator-app/old_trunk
Diff against target: 58 lines (+19/-22)
1 file modified
Simple/SimplePage.qml (+19/-22)
To merge this branch: bzr merge lp:~mihirsoni/ubuntu-calculator-app/1188292
Reviewer Review Type Date Requested Status
Riccardo Padovani Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Gustavo Pichorim Boiko (community) Needs Fixing
David Planella Approve
Mihir Soni Pending
Review via email: mp+181294@code.launchpad.net

Commit message

Instead of saving calculation while user close this application , Save calculation when user tear-off the calculation.

Description of the change

Save calculation when the user tears off the calculation.

To post a comment you must log in.
Revision history for this message
Ravi Vagadia (ravirdv) wrote :

Hi Mihir,

Please remove

+ console.log("I am here");

Remaining changes look good.

Cheers,
Ravi Vagadia
+91 9898789881
http://www.ravi.ws

On Wed, Aug 21, 2013 at 6:43 PM, Mihir Soni <email address hidden> wrote:

> The proposal to merge lp:~mihirsoni-123/ubuntu-calculator-app/1188292 into
> lp:ubuntu-calculator-app has been updated.
>
> Commit Message changed to:
>
> Instead of saving calculation while user close this application , Save
> calculation when user tear-off the calculation.
>
> For more details, see:
>
> https://code.launchpad.net/~mihirsoni-123/ubuntu-calculator-app/1188292/+merge/181294
> --
>
> https://code.launchpad.net/~mihirsoni-123/ubuntu-calculator-app/1188292/+merge/181294
> Your team Ubuntu Calculator Developers is requested to review the proposed
> merge of lp:~mihirsoni-123/ubuntu-calculator-app/1188292 into
> lp:ubuntu-calculator-app.
>

Revision history for this message
David Planella (dpm) wrote :

Thanks for the fix!

Just a few small nitpicks:

34 + //update the storage when user tear-off the calculation

Could you fix the comment to say "// Save the calculation when the user tears it off

39 + if(operators.count !== undefined){
40 + for(var j=0; j< operators.count; j++){
41 + newop.push(operators.get(j));
42 + }

I know you didn't introduce this change, but if you could fix the indentation of this for {} loop, it'd be great.

Thanks!

review: Needs Fixing
Revision history for this message
David Planella (dpm) wrote :

Looks good now and it works as expected on the device.

review: Approve
Revision history for this message
David Planella (dpm) wrote :

Note that while not related to this change, this merge proposal seems to uncover an issue with the app:

Once there are a few calculations saved and you start scrolling up, the app becomes unresponsive.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Actually as we are going to be saving when tearing off, we can be more selective on what we save: instead of saving everything every time, we can only save the calculations that were not yet saved and/or the ones that were modified, what do you think?

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

7 Component.onDestruction: {

As the Component.onDestruction is empty now, we can remove it. Could you please fix that?

review: Needs Fixing
142. By Mihir Soni

Removed on Destruction signal

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
Riccardo Padovani (rpadovani) wrote :

Works as expected!

Great job Mihir, thanks :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Simple/SimplePage.qml'
2--- Simple/SimplePage.qml 2013-08-12 12:13:12 +0000
3+++ Simple/SimplePage.qml 2013-08-24 08:14:26 +0000
4@@ -207,28 +207,6 @@
5 currentOperatorsChanged();
6 }
7
8- Component.onDestruction: {
9- //update the storage
10- var calculations = []
11- for(var i=1; i<memory.count; i++){
12- var operators = memory.get(i).operators;
13- var newop = [];
14- if(operators.count !== undefined){
15- for(var j=0; j< operators.count; j++){
16- newop.push(operators.get(j));
17- }
18- }else{
19- newop = operators
20- }
21- var newElement = {'dbId': memory.get(i).dbId,
22- 'isLastItem': false,
23- 'mainLabel': memory.get(i).mainLabel,
24- 'operators': newop};
25- calculations.push({"calc": newElement, "date": memory.get(i).timeStamp})
26- }
27- storage.saveCalculations(calculations)
28- }
29-
30 onMovementStarted: {
31 __wasAtYBegining = atYEnd
32 __initialContentY = contentY
33@@ -248,6 +226,25 @@
34 formulaView.addCurrentToMemory();
35 clear();
36 __toBeRefresh = false
37+ //Save the calculation when the user tears it off
38+ var calculations = []
39+ for(var i=1; i<memory.count; i++){
40+ var operators = memory.get(i).operators;
41+ var newop = [];
42+ if(operators.count !== undefined){
43+ for(var j=0; j< operators.count; j++){
44+ newop.push(operators.get(j));
45+ }
46+ }else{
47+ newop = operators
48+ }
49+ var newElement = {'dbId': memory.get(i).dbId,
50+ 'isLastItem': false,
51+ 'mainLabel': memory.get(i).mainLabel,
52+ 'operators': newop};
53+ calculations.push({"calc": newElement, "date": memory.get(i).timeStamp})
54+ }
55+ storage.saveCalculations(calculations)
56 }
57 }
58 }

Subscribers

People subscribed via source and target branches