// st.variants changes only once, at loading from [] to [...]
"st.variants": function() {
// Set potential games variant names + display:
- this.livesGames.concat(this.corrGames).concat(this.importGames)
+ this.liveGames.concat(this.corrGames).concat(this.importGames)
.forEach(o => {
if (!o.vname) this.setVname(o);
});
this.corrGames.forEach(g => {
g.type = "corr";
g.score = "*";
+ g.options = JSON.parse(g.options);
});
this.decorate(this.corrGames);
// Now ask completed games (partial list)
case "notifynewgame": {
let gameInfo = data.data;
this.setVname(gameInfo);
+ // TODO: remove patch on next line (options || "{}")
+ gameInfo.options = JSON.parse(gameInfo.options || "{}");
const type = (gameInfo.cadence.indexOf('d') >= 0 ? "corr": "live");
let game = Object.assign(
{
if (L > 0) {
this.cursor["corr"] = res.games[L - 1].created;
let moreGames = res.games;
- moreGames.forEach(g => g.type = "corr");
+ moreGames.forEach(g => {
+ g.type = "corr";
+ g.options = JSON.parse(g.options);
+ });
this.decorate(moreGames);
this.corrGames = this.corrGames.concat(moreGames);
}
this.cursor["live"] = localGames[L - 1].created - 1;
localGames.forEach(g => {
g.type = "live";
- if (!g.options) g.options = {}; //TODO: remove patch
+ // TODO: remove patch on next line (options || "{}")
+ g.options = JSON.parse(g.options || "{}");
});
this.decorate(localGames);
this.liveGames = this.liveGames.concat(localGames);
this.cursor["import"] = importGames[L - 1].created - 1;
importGames.forEach(g => {
g.type = "import";
- if (!g.options) g.options = {}; //TODO: remove patch
+ // TODO: remove following patch (options || "{}")
+ g.options = JSON.parse(g.options || "{}");
this.setVname(g);
});
this.importGames = this.importGames.concat(importGames);