From 6051dd15c1cc2adb540521793897108238b38775 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 18 Sep 2021 20:25:32 -0400 Subject: [PATCH] very beginnings of test result reporting --- package.json | 2 +- src/games/GameCore.tsx | 22 +++++++++++++--------- yarn.lock | 8 ++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 93ae101..b4f8ea0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "@fortawesome/fontawesome-free": "^5.15.2", - "@lingdocs/lingdocs-main": "^0.0.9", + "@lingdocs/lingdocs-main": "^0.1.1", "@lingdocs/pashto-inflector": "^1.0.5", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", diff --git a/src/games/GameCore.tsx b/src/games/GameCore.tsx index f2eb4c5..f8f2f18 100644 --- a/src/games/GameCore.tsx +++ b/src/games/GameCore.tsx @@ -7,6 +7,10 @@ import "./timer.css"; import { getPercentageDone, } from "../lib/game-utils"; +import { + AT, + getTimestamp, +} from "@lingdocs/lingdocs-main"; import { Types as T, } from "@lingdocs/pashto-inflector"; @@ -43,17 +47,17 @@ function GameCore({ questions, Display, timeLimit, Instructions, studyLink, i else setCurrent(next.value); } function handleFinish() { - if (user) { - // TODO: post results - console.log( - "will post results for", - user.userId, - "results id", - id, - ); - } setFinish("pass"); rewardRef.current?.rewardMe(); + if (user) { + const result: AT.TestResult = { + done: true, + time: getTimestamp(), + id, + }; + // TODO: post results + console.log("will post result", JSON.stringify(result)); + } } function handleQuit() { setFinish(null); diff --git a/yarn.lock b/yarn.lock index 57409e2..4ae06ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1566,10 +1566,10 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@lingdocs/lingdocs-main@^0.0.9": - version "0.0.9" - resolved "https://npm.lingdocs.com/@lingdocs%2flingdocs-main/-/lingdocs-main-0.0.9.tgz#beaf25d0e6aad15594e595b2b17ed427c7cbb332" - integrity sha512-DIlMJb64etwXLLtzm2Gx9BUnXT2vuyc7i9YQHuYC1iaQESAAt49RvvQTIRz9B1F+U/faSvTno8W93PGNb0wgng== +"@lingdocs/lingdocs-main@^0.1.1": + version "0.1.1" + resolved "https://npm.lingdocs.com/@lingdocs%2flingdocs-main/-/lingdocs-main-0.1.1.tgz#b4b7b8774821e5188a8deb7312cd2db0410115d1" + integrity sha512-Khh1bZ2ZB9BowB1Thp38hrJnHyVQfeQBFFYV1Juc0YLsGInCAAptI4QGSOL1PXRGhYIwQwrgu+1J/dFyDO/6CA== dependencies: nano "^9.0.5" passport-github2 "^0.1.12"