mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:39:28 +00:00
Test.getAverageScore and Percentage should return whole numbers
This commit is contained in:
@@ -154,14 +154,14 @@ class Test {
|
|||||||
async getAverageScore() {
|
async getAverageScore() {
|
||||||
const trs = await this.getTestResults();
|
const trs = await this.getTestResults();
|
||||||
|
|
||||||
return trs.reduce((a, b) => a + b.mark, 0) /
|
return Math.round(trs.reduce((a, b) => a + b.mark, 0) /
|
||||||
(trs.length || 1);
|
(trs.length || 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAveragePercentage() {
|
async getAveragePercentage() {
|
||||||
return await this.getAverageScore() /
|
return Math.round(await this.getAverageScore() /
|
||||||
this.template.maxMark *
|
this.template.maxMark *
|
||||||
100;
|
100);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addResult(accountId, studentId, mark) {
|
async addResult(accountId, studentId, mark) {
|
||||||
|
|||||||
Reference in New Issue
Block a user