Skip to content

Commit

Permalink
Merge pull request #88 from eddex/fix/calculating_credits_by_semester…
Browse files Browse the repository at this point in the history
…_correctly

Fix calculating the semster credits
  • Loading branch information
Lextum authored Oct 16, 2021
2 parents 85878d9 + 5925c14 commit e2ef10c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})
Expand Down

0 comments on commit e2ef10c

Please sign in to comment.