From 85d25439fd58bd0d3fdd21ee8f94d863dd961e05 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 25 Feb 2022 19:52:45 +0000 Subject: [PATCH] Add ability to extract Class from Test --- lib/Test.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Test.js b/lib/Test.js index 4ee4d42..0b159b4 100644 --- a/lib/Test.js +++ b/lib/Test.js @@ -45,6 +45,12 @@ class Test { */ classId; + /** + * The class object that it is assigned to + * @type {Class} + */ + class; + /** * The test date in epoch seconds * @type {number} @@ -86,14 +92,15 @@ class Test { this[k] = v; this.date = new TestDate(this.epochDate * 1000); - this.template = await new TestTemplate(this.templateId); + + this.class = await this.getClass(); return this; })(); } - get class() { - + async getClass() { + return new (require('./Class'))(this.classId); } get students() {