Merge lp:~vthompson/dropping-letters/reset-game-and-set-high-score into lp:dropping-letters

Proposed by Victor Thompson
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 45
Merged at revision: 47
Proposed branch: lp:~vthompson/dropping-letters/reset-game-and-set-high-score
Merge into: lp:dropping-letters
Diff against target: 64 lines (+17/-13)
1 file modified
dropping-letters.qml (+17/-13)
To merge this branch: bzr merge lp:~vthompson/dropping-letters/reset-game-and-set-high-score
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Needs Fixing
Riccardo Padovani (community) Approve
Review via email: mp+200465@code.launchpad.net

Commit message

Reset score when New game is selected and update the highscore, if applicable.

Description of the change

Reset score when New game is selected and update the highscore, if applicable.

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)
Revision history for this message
Victor Thompson (vthompson) wrote :

Could I get this reviewed?

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

Works as expected, thanks Victor!

review: Approve
Revision history for this message
Victor Thompson (vthompson) wrote :

Could this get a final review please?

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

I played the game till the end (red vertical bar) and it certainly updated the best score, however pressing "New Game" did nothing.

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

I can merge trunk into this branch, but the issue you are seeing was fixed by lp:1266095 [1]

[1] https://code.launchpad.net/~vthompson/dropping-letters/restart-game-play/+merge/200467

45. By Victor Thompson

Merge and resolve conflicts

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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dropping-letters.qml'
2--- dropping-letters.qml 2014-01-26 21:02:38 +0000
3+++ dropping-letters.qml 2014-04-22 00:56:25 +0000
4@@ -23,6 +23,8 @@
5 accum.text = "";
6 droptimer.tickCount = 0;
7 flipable.flipped = true;
8+ bestscore.updateScore(main.score);
9+ main.score = 0;
10 droptimer.start();
11 toolbar.opened = false;
12 }
13@@ -81,13 +83,8 @@
14 db.transaction(function(tx) {
15 // Create the database if it doesn't already exist
16 tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(score INT, time TEXT)');
17- var res = tx.executeSql('SELECT score from Scores order by score DESC LIMIT 1');
18- if (res.rows.length === 0) {
19- bestscore.updateScore(0);
20- } else {
21- bestscore.updateScore(res.rows.item(0).score);
22- }
23 });
24+ bestscore.updateScore(0);
25 }
26
27 states: [
28@@ -192,10 +189,21 @@
29 fontSize: "large"
30 color: "#222222"
31 function updateScore(score) {
32- if (score >= bestscore.bestsofar) {
33- bestscore.text = "Best score: " + score;
34+ var db = LocalStorage.openDatabaseSync("dropping-letters", "1.0", "Dropping Letters", 1000);
35+ if (score > bestscore.bestsofar) {
36+ db.transaction(function(tx) {
37+ tx.executeSql("insert into Scores values (?,?)", [main.score, 0]);
38+ });
39 bestscore.bestsofar = score;
40+ } else if (score === 0) {
41+ db.transaction(function(tx) {
42+ var res = tx.executeSql('SELECT score from Scores order by score DESC LIMIT 1');
43+ if (res.rows.length > 0) {
44+ bestscore.bestsofar = res.rows.item(0).score;
45+ }
46+ });
47 }
48+ bestscore.text = "Best score: " + bestscore.bestsofar
49 }
50 }
51
52@@ -516,11 +524,7 @@
53 if (volume.supportsMedia) {
54 gameover.play();
55 }
56- var db = LocalStorage.openDatabaseSync("dropping-letters", "1.0", "Dropping Letters", 1000);
57- db.transaction(function(tx) {
58- tx.executeSql("insert into Scores values (?,?)", [main.score, 0]);
59- bestscore.updateScore(main.score);
60- });
61+ bestscore.updateScore(main.score);
62 }
63 }
64 }

Subscribers

People subscribed via source and target branches