changed block mean formula
This commit is contained in:
+4
-1
@@ -447,7 +447,10 @@ function save() {
|
|||||||
function blockMean(blockId) {
|
function blockMean(blockId) {
|
||||||
const graded = S.courses.filter(c => c.blockId === blockId && c.grade != null && c.grade !== '');
|
const graded = S.courses.filter(c => c.blockId === blockId && c.grade != null && c.grade !== '');
|
||||||
if (!graded.length) return null;
|
if (!graded.length) return null;
|
||||||
return graded.reduce((s, c) => s + +c.grade, 0) / graded.length;
|
const sumWeighted = graded.reduce((s, c) => s + +c.grade * (+c.credits || 0), 0);
|
||||||
|
const sumCoef = graded.reduce((s, c) => s + (+c.credits || 0), 0);
|
||||||
|
if (sumCoef === 0) return null;
|
||||||
|
return sumWeighted / sumCoef;
|
||||||
}
|
}
|
||||||
|
|
||||||
// status: 'pass' | 'fail' | 'prog'
|
// status: 'pass' | 'fail' | 'prog'
|
||||||
|
|||||||
Reference in New Issue
Block a user