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

Implemented grade boundaries for TestTemplate

This commit is contained in:
2022-04-18 21:38:48 +00:00
parent 1accae5851
commit e9d38b25b0

View File

@@ -6,6 +6,7 @@ const crypto = require('crypto');
// Import user defined modules
const Class = require('./Class');
const Test = require('./Test');
const GradeBoundaries = require('./GradeBoundaries');
/**
* A class that represents a test template
@@ -41,6 +42,8 @@ class TestTemplate {
*/
maxMark;
gradeBoundaries;
#conn;
/**
@@ -54,7 +57,8 @@ class TestTemplate {
testTemplateId as id,
accountId,
name,
maxMark
maxMark,
gradeBoundaries
from
testTemplate
where
@@ -70,7 +74,15 @@ class TestTemplate {
throw new Error('No test template found');
for (const [ k, v ] of Object.entries(record[0]))
this[k] = v;
this[k] = v ?? undefined;
if (this.gradeBoundaries) {
this.gradeBoundaries =
JSON.parse(this.gradeBoundaries);
}
this.gradeBoundaries =
new GradeBoundaries(this.gradeBoundaries);
this.account = await this.getAccount();