Stats card oh history screen

This commit is contained in:
2023-07-22 10:58:14 +01:00
parent 80e3d270c8
commit 1d04006335
2 changed files with 16 additions and 0 deletions

View File

@@ -54,4 +54,10 @@
#tasks {
overflow: scroll;
}
pre {
padding: 0;
background: white;
border-radius: 0;
}

View File

@@ -60,6 +60,12 @@ async function populateScreen() {
let historyRaw = await response.json();
let history = historyRaw.history;
// get points data
let statsPage = document.getElementById("statData");
statsPage.innerText = "";
response = await fetch("/getUserPoints");
let statsRaw = await response.json();
let stats = statsRaw.userPoints;
for (let i = 0; i < tasks.length; i++) {
taskPage.innerHTML += `
@@ -83,6 +89,10 @@ async function populateScreen() {
</article>
</div>`
}
for (let i = 0; i < stats.length; i++) {
// put user points in box
statsPage.innerText += `${stats[i].name}: ${stats[i].points} \n`
}
}
async function completeTask(taskID) {