From 9ae60ef85b6d4e072ebe93b95cf758a9824b8f1c Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 24 Apr 2022 18:49:39 +0000 Subject: [PATCH] Parents should be notified about test results --- lib/Test.js | 5 ++++- lib/TestResult.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Test.js b/lib/Test.js index 97fb5b3..a71c0b0 100644 --- a/lib/Test.js +++ b/lib/Test.js @@ -173,8 +173,11 @@ class Test { mark ); + const parents = await tr.student.getParents(); + const email = new EmailBuilder() - .addTo([ tr.student.getEmail() ]) + .addTo([ tr.student, ...parents ] + .map(u => u.getEmail())) .setSubject('Stratos - Test result added') .setBody( 'Your result has been added for ' + diff --git a/lib/TestResult.js b/lib/TestResult.js index 11acbcc..8c2f8d7 100644 --- a/lib/TestResult.js +++ b/lib/TestResult.js @@ -114,8 +114,11 @@ class TestResult { `(${this.percentage}%) which is a grade ` + `${this.grade}`; + const parents = await this.student.getParents(); + const email = new EmailBuilder() - .addTo([ this.student.getEmail() ]) + .addTo([ this.student, ...parents ] + .map(u => u.getEmail())) .setSubject('Stratos - Test result changed') .setBody(body);