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();