From 28f8b8dae8f30a0175b47795b77f8ea1bd6e7c85 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 25 Feb 2022 19:52:46 +0000 Subject: [PATCH] Add ability to extract TestTemplate from Test --- lib/Test.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Test.js b/lib/Test.js index 0b159b4..96a0a83 100644 --- a/lib/Test.js +++ b/lib/Test.js @@ -3,8 +3,6 @@ // Import user defined modules const DatabaseConnectionPool = require('./DatabaseConnectionPool'); -const TestTemplate = require('./TestTemplate'); - /** * A class that represents the date of a test */ @@ -93,7 +91,13 @@ class Test { this.date = new TestDate(this.epochDate * 1000); - this.class = await this.getClass(); + const [ template, c ] = await Promise.all([ + this.getTestTemplate(), + this.getClass() + ]); + + this.template = template; + this.class = c; return this; })(); @@ -103,11 +107,11 @@ class Test { return new (require('./Class'))(this.classId); } - get students() { - + async getTestTemplate() { + return new (require('./TestTemplate'))(this.templateId); } - get testTemplate() { + get students() { }