Skip to content

Commit

Permalink
fix aisd semester average calculation, update version number
Browse files Browse the repository at this point in the history
  • Loading branch information
xsznix committed Dec 24, 2013
1 parent c55929a commit a61bd39
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
31 changes: 25 additions & 6 deletions hac_dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,16 @@ var HAC_HTML =
// each cell
for (var i = 0; i < 10; i++) {
if (i == 4 || i == 9) {
var earned = 0, weight = 0, weightPerSixWeeks = 85 / 300;
var earned = 0, weight = 0,
weightPerSixWeeks = 85 / 300,
examWeight;
if (localStorage["district"] == "rrisd") {
weightPerSixWeeks = 85 / 300;
examWeight = 0.15;
} else {
weightPerSixWeeks = 0.25;
examWeight = 0.25;
}
// calculate semester average (issue #45)
// TODO: use same calculations as the grade edit finaliser
for (var j = i - 4; j < i - 1; j++) {
Expand All @@ -79,8 +88,8 @@ var HAC_HTML =
}
// add exam grade
if (grades[i-1] != "" && !isNaN(grades[i-1])){
earned += parseInt(grades[i-1]) * 0.15;
weight += 0.15;
earned += parseInt(grades[i-1]) * examWeight;
weight += examWeight;
}
// calculate
var semesterGrade = earned / weight;
Expand Down Expand Up @@ -826,7 +835,17 @@ var HAC_HTML =
examCell = subject[9];
semAvgCell = subject[10];
}
var semAvg = 0, weightTotal = 0, weightPerSixWeeks = 85 / 300;
var semAvg = 0,
weightTotal = 0,
weightPerSixWeeks,
examWeight;
if (localStorage["district"] == "rrisd") {
weightPerSixWeeks = 85 / 300;
examWeight = 0.15;
} else {
weightPerSixWeeks = 0.25;
examWeight = 0.25;
}
for (var i = 0; i < sixWeeksCells.length; i++) {
cell = sixWeeksCells[i];
if (cell.innerHTML != "") {
Expand All @@ -835,8 +854,8 @@ var HAC_HTML =
}
}
if (examCell.innerText != "" && !isNaN(examCell.innerText)) {
semAvg += parseInt(examCell.innerText) * 0.15;
weightTotal += 0.15;
semAvg += parseInt(examCell.innerText) * examWeight;
weightTotal += examWeight;
}
semAvg *= 1 / weightTotal;
semAvg = Math.max(Math.min(semAvg, 100), 0);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "QuickHAC",
"version": "2.1.9",
"version": "2.1.10",
"manifest_version": 2,
"description": "Quickly and efficiently check your grades.",
"browser_action": {
Expand Down

0 comments on commit a61bd39

Please sign in to comment.