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:
20
lib/Test.js
20
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user