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
=== modified file 'dropping-letters.qml'
--- dropping-letters.qml 2014-01-26 21:02:38 +0000
+++ dropping-letters.qml 2014-04-22 00:56:25 +0000
@@ -23,6 +23,8 @@
23 accum.text = "";23 accum.text = "";
24 droptimer.tickCount = 0;24 droptimer.tickCount = 0;
25 flipable.flipped = true;25 flipable.flipped = true;
26 bestscore.updateScore(main.score);
27 main.score = 0;
26 droptimer.start();28 droptimer.start();
27 toolbar.opened = false;29 toolbar.opened = false;
28 }30 }
@@ -81,13 +83,8 @@
81 db.transaction(function(tx) {83 db.transaction(function(tx) {
82 // Create the database if it doesn't already exist84 // Create the database if it doesn't already exist
83 tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(score INT, time TEXT)');85 tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(score INT, time TEXT)');
84 var res = tx.executeSql('SELECT score from Scores order by score DESC LIMIT 1');
85 if (res.rows.length === 0) {
86 bestscore.updateScore(0);
87 } else {
88 bestscore.updateScore(res.rows.item(0).score);
89 }
90 });86 });
87 bestscore.updateScore(0);
91 }88 }
9289
93 states: [90 states: [
@@ -192,10 +189,21 @@
192 fontSize: "large"189 fontSize: "large"
193 color: "#222222"190 color: "#222222"
194 function updateScore(score) {191 function updateScore(score) {
195 if (score >= bestscore.bestsofar) {192 var db = LocalStorage.openDatabaseSync("dropping-letters", "1.0", "Dropping Letters", 1000);
196 bestscore.text = "Best score: " + score;193 if (score > bestscore.bestsofar) {
194 db.transaction(function(tx) {
195 tx.executeSql("insert into Scores values (?,?)", [main.score, 0]);
196 });
197 bestscore.bestsofar = score;197 bestscore.bestsofar = score;
198 } else if (score === 0) {
199 db.transaction(function(tx) {
200 var res = tx.executeSql('SELECT score from Scores order by score DESC LIMIT 1');
201 if (res.rows.length > 0) {
202 bestscore.bestsofar = res.rows.item(0).score;
203 }
204 });
198 }205 }
206 bestscore.text = "Best score: " + bestscore.bestsofar
199 }207 }
200 }208 }
201209
@@ -516,11 +524,7 @@
516 if (volume.supportsMedia) {524 if (volume.supportsMedia) {
517 gameover.play();525 gameover.play();
518 }526 }
519 var db = LocalStorage.openDatabaseSync("dropping-letters", "1.0", "Dropping Letters", 1000);527 bestscore.updateScore(main.score);
520 db.transaction(function(tx) {
521 tx.executeSql("insert into Scores values (?,?)", [main.score, 0]);
522 bestscore.updateScore(main.score);
523 });
524 }528 }
525 }529 }
526 }530 }

Subscribers

People subscribed via source and target branches