1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 15:59:25 +00:00

Implemented TestTemplate.getTests

This commit is contained in:
2022-04-21 13:15:11 +00:00
parent aa332ef5f7
commit 3b29698f35

View File

@@ -94,6 +94,26 @@ class TestTemplate {
return new (require('./Account'))(this.#conn, this.accountId);
}
async getTests() {
const sql = `
select
testId as id
from
test
where
testTemplateId = ?;
`;
return await Promise.all(
(await this.#conn.runQuery(sql, [ this.id ]))
.map(record => {
return new (require('./Test'))(
this.#conn,
record.id);
})
);
}
async assignClass(classId, date) {
const c = await new Class(this.#conn, classId);
const id = crypto.randomUUID();