From ac1420a26eab929128922df1eb59af0d06470127 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 18 Apr 2022 12:57:27 +0000 Subject: [PATCH] Added Test.getTestResults --- lib/Test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/Test.js b/lib/Test.js index e807e88..e81d0e1 100644 --- a/lib/Test.js +++ b/lib/Test.js @@ -115,6 +115,26 @@ class Test { ); } + async getTestResults() { + const sql = ` + select + testResultId + from + testResult + where + testId = ?; + `; + + const records = await this.#conn.runQuery(sql, [ this.id ]); + + return Promise.all(records.map(r => { + return new (require('./TestResult'))( + this.#conn, + r.testResultId + ); + })); + } + async hasAccess(u) { const userTests = await u.getTests();