From cd875d986f7dcc8ccd0db3367d270a4dbfe7a8b7 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 21 Apr 2022 13:15:34 +0000 Subject: [PATCH] Added setters for TestTemplate --- lib/TestTemplate.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/TestTemplate.js b/lib/TestTemplate.js index c8588c1..dd11b15 100644 --- a/lib/TestTemplate.js +++ b/lib/TestTemplate.js @@ -139,6 +139,42 @@ class TestTemplate { return new Test(this.#conn, id); } + async setMaxMark(maxMark) { + const sql = ` + update + testTemplate + set + maxMark = ? + where + testTemplateId = ?; + `; + + await this.#conn.runQuery(sql, [ + maxMark, + this.id + ]); + + this.maxMark = maxMark; + } + + async setName(name) { + const sql = ` + update + testTemplate + set + name = ? + where + testTemplateId = ?; + `; + + await this.#conn.runQuery(sql, [ + name, + this.id + ]); + + this.name = name; + } + hasAccess(u) { return u != null; }