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() { }