diff --git a/data/results.json b/data/results.json index 39d572a..ec3db51 100644 --- a/data/results.json +++ b/data/results.json @@ -1,38 +1,44 @@ { - "student1": { - "score": 8, - "completed": true, - "answers": [ - { - "word": "apple", - "correct": true - }, - { - "word": "banana", - "correct": false - }, - { - "word": "grape", - "correct": true - } - ] - }, - "nate": { - "score": 1, - "completed": true, - "answers": [ - { - "word": "not", - "correct": false - }, - { - "word": "bot", - "correct": false - }, - { - "word": "snot", - "correct": true - } - ] - } + "student1": [ + { + "score": 8, + "completed": true, + "answers": [ + { + "word": "apple", + "correct": true + }, + { + "word": "banana", + "correct": false + }, + { + "word": "grape", + "correct": true + } + ], + "timestamp": "2025-07-07T12:14:21.057Z" + } + ], + "nate": [ + { + "score": 1, + "completed": true, + "answers": [ + { + "word": "not", + "correct": false + }, + { + "word": "bot", + "correct": false + }, + { + "word": "snot", + "correct": true + } + ], + "timestamp": "2025-07-07T12:14:21.058Z" + } + ] } \ No newline at end of file diff --git a/migrateResults.js b/migrateResults.js new file mode 100644 index 0000000..62b082b --- /dev/null +++ b/migrateResults.js @@ -0,0 +1,16 @@ +const fs = require('fs'); +const path = require('path'); + +const resultsPath = path.join(__dirname, 'data', 'results.json'); +const existingData = JSON.parse(fs.readFileSync(resultsPath)); + +for (const username in existingData) { + const singleResult = existingData[username]; + existingData[username] = [{ + ...singleResult, + timestamp: new Date().toISOString() + }]; +} + +fs.writeFileSync(resultsPath, JSON.stringify(existingData, null, 2)); +console.log("✅ Migration complete. Results are now session arrays."); \ No newline at end of file diff --git a/public/index.html b/public/index.html index dd9551c..82e527f 100644 --- a/public/index.html +++ b/public/index.html @@ -52,6 +52,7 @@ + @@ -121,6 +122,7 @@ + + + + +