diff --git a/lib/Test.js b/lib/Test.js index 92f57b5..97fb5b3 100644 --- a/lib/Test.js +++ b/lib/Test.js @@ -154,14 +154,14 @@ class Test { async getAverageScore() { const trs = await this.getTestResults(); - return trs.reduce((a, b) => a + b.mark, 0) / - (trs.length || 1); + return Math.round(trs.reduce((a, b) => a + b.mark, 0) / + (trs.length || 1)); } async getAveragePercentage() { - return await this.getAverageScore() / + return Math.round(await this.getAverageScore() / this.template.maxMark * - 100; + 100); } async addResult(accountId, studentId, mark) {