From 5925c14baae60464342adffc0204c91b775be8c4 Mon Sep 17 00:00:00 2001 From: Letum Date: Sat, 16 Oct 2021 16:44:12 +0200 Subject: [PATCH] fix calculating the semster credits --- src/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index be0da34..0d81d6e 100644 --- a/src/main.js +++ b/src/main.js @@ -343,8 +343,10 @@ function createChart(div, modules) { const creditsDoneBySemesterCount = [0, 0, 0, 0, 0, 0, 0, 0, 0]; // calculate how many credits were achieved for each semester + // Only show the modules that are passed or are from the active semester + const activeSemester = Math.max.apply(Math, modules.map(function(o) { return o.semester; })) modules.forEach(m => { - if (m.grade != 'F' && m.semester != undefined && m.UseInStats) { + if ((m.passed && m.semester != undefined && m.UseInStats) || m.semester == activeSemester) { creditsDoneBySemesterCount[m.semester] += Number(m.credits); } })