{{ formattedTime }}
@@ -285,6 +206,9 @@ new Vue({
let minutes = Math.floor(this.time / 60);
return this.padToZero(minutes) + ":" + this.padToZero(seconds);
},
+ textHeight: function() {
+ return screen.height;
+ },
},
methods: {
padToZero: function(a) {
@@ -299,7 +223,7 @@ new Vue({
},
reset: function(e) {
this.running = false;
- this.time = 10; //1:30
+ this.time = 5400; //1:30
},
start: function() {
if (!this.running)
@@ -321,6 +245,93 @@ new Vue({
this.reset();
},
},
+ 'my-ranking': {
+ props: ['players','sortByScore','writeScoreToDb'],
+ template: `
+
+
+
+ Rang |
+ Joueur |
+ Points |
+ Mini-pts |
+
+
+ {{ p.rank }} |
+ {{ p.prenom }} {{ p.nom }} |
+ {{ p.pdt }} |
+ {{ p.session }} |
+
+
+
+
+
+
+
+ `,
+ computed: {
+ sortedPlayers: function() {
+ let res = this.rankPeople();
+ // Add rank information (taking care of ex-aequos)
+ let rank = 1;
+ for (let i=0; i
{
+ p.pdt = 0;
+ p.session = 0;
+ p.available = 1;
+ });
+ this.writeScoreToDb();
+ document.getElementById("runPairing").click();
+ },
+ restoreLast: function() {
+ let xhr = new XMLHttpRequest();
+ let self = this;
+ xhr.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200)
+ {
+ let players = JSON.parse(xhr.responseText);
+ if (players.length > 0)
+ {
+ players.unshift({ //add ghost 4th player for 3-players tables
+ prenom: "Toto",
+ nom: "",
+ pdt: 0,
+ session: 0,
+ available: 0,
+ });
+ // NOTE: Vue warning "do not mutate property" if direct self.players = players
+ for (let i=1; i { return Object.assign({}, p); }) //deep (enough) copy
.sort(this.sortByScore);
xhr.send("players="+encodeURIComponent(JSON.stringify(orderedPlayers)));
},