1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 20:39:28 +00:00

Added Test.getTestResults

This commit is contained in:
2022-04-18 12:57:27 +00:00
parent 318bdd3b30
commit ac1420a26e

View File

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