From: Benjamin Auder Date: Sat, 30 Dec 2017 19:12:01 +0000 (+0100) Subject: allow scores reset through CSV init X-Git-Url: https://git.auder.net/variants/Chakart/doc/html/current/git-logo.png?a=commitdiff_plain;h=d940eb68fd6f58a6f637261854a6da615d087dea;p=westcastle.git allow scores reset through CSV init --- diff --git a/js/index.js b/js/index.js index 4bffa63..5f18704 100644 --- a/js/index.js +++ b/js/index.js @@ -408,7 +408,11 @@ new Vue({ .filter( line => { return line.length > 0; }) //remove empty lines .map( line => { let parts = line.split(","); - return {prenom: parts[0], nom: parts[1], pdt: 0, session:0, available: 1}; + let p = { prenom: parts[0], nom: parts[1] }; + p.pdt = parts.length > 2 ? parseFloat(parts[2]) : 0; + p.session = parts.length > 3 ? parseInt(parts[3]) : 0; + p.available = parts.length > 4 ? parts[4] : 1; + return p; }); this.addToto(players); this.players = players;