From 2fb7ba00b458f94dff3e924b245c8f02dc20525a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 31 May 2020 17:49:47 -0700 Subject: [PATCH] LMNO: Simplify storage of the games array by not storing ID next to game In the previous commit, we ensured that a game object always knows its own ID, so it's unnecessary to store it alongside. Delete this field from this anonymous object and change all references to instead access game.id. --- lmno.js | 3 +-- templates/admin.html | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lmno.js b/lmno.js index 0fd491a..5f5b2c7 100644 --- a/lmno.js +++ b/lmno.js @@ -71,7 +71,6 @@ class LMNO { const game = new engine.Game(id); this.games[id] = { - id: id, game: game }; @@ -136,7 +135,7 @@ app.get('/[a-zA-Z0-9]{4}', (request, response) => { response.sendStatus(404); return; } - response.redirect(301, `/${game.game.meta.identifier}/${game.id}/`); + response.redirect(301, `/${game.game.meta.identifier}/${game.game.id}/`); }); /* LMNO middleware to lookup the game. */ diff --git a/templates/admin.html b/templates/admin.html index 051d485..4db60ce 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -12,7 +12,7 @@