mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 19:59:27 +00:00
Change implementation of Test.dateString
This commit is contained in:
23
lib/Test.js
23
lib/Test.js
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-empty-function, getter-return */
|
||||
'use strict';
|
||||
|
||||
const { EmailBuilder, Emailer } = require('./Emailer');
|
||||
@@ -118,14 +117,18 @@ class Test {
|
||||
);
|
||||
}
|
||||
|
||||
get dateString() {
|
||||
return this.date.toLocaleDateString('en-GB', {
|
||||
getDateString(long = true) {
|
||||
const options = {
|
||||
timeZone: 'Europe/London',
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'numeric',
|
||||
year: 'numeric'
|
||||
});
|
||||
};
|
||||
|
||||
if (long)
|
||||
options.weekday = 'long';
|
||||
|
||||
return this.date.toLocaleDateString('en-GB', options);
|
||||
}
|
||||
|
||||
async getTestResults() {
|
||||
@@ -163,7 +166,7 @@ class Test {
|
||||
.setBody(
|
||||
'Your result has been added for ' +
|
||||
`the test "${this.template.name}" that you ` +
|
||||
`took on ${this.dateString}\n\n` +
|
||||
`took on ${this.getDateString()}\n\n` +
|
||||
`You scored ${mark}/${this.template.maxMark} ` +
|
||||
`(${tr.percentage}%) which is a grade ` +
|
||||
`${tr.grade}`
|
||||
@@ -197,14 +200,6 @@ class Test {
|
||||
return t.id === this.id;
|
||||
}).length;
|
||||
}
|
||||
|
||||
calculateAverageScore() {
|
||||
|
||||
}
|
||||
|
||||
calculateGradeBoundaries() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Test;
|
||||
|
||||
Reference in New Issue
Block a user