2nd condition won't execute; gpa from number to letter grade
I updated my js code to ouput a letter grade instead of gpa. The logic for calculating average is working, but my second condition is not executing. They both should show letter grade. So output shows as indicated on UI Can you give me some direction?
Below is my code..I have the service, dbase, UI and labels all setup correctly.
var courtesyVal = 0,
overallVal = 0,
i;
if (data.length) {
Code: Select all
for (i = 0; i < data.length; i++) {
courtesyVal += data[i].grade_courtesy;
overallVal += data[i].grade_overall;
}
courtesyVal = (courtesyVal / data.length);
overallVal = (overallVal / data.length); }
if (courtesyVal = 4 overallVal = 4) {
courtesyVal = ("A") overallVal("A");
} else if (courtesyVal = 3 overallVal = 3) {
courtesyVal = ("B") overallVal("B");
} else if (courtesyVal = 2 overallVal = 2) {
courtesyVal = ("C") overallVal("C");
} else if (courtesyVal = 1 overallVal = 1) {
courtesyVal = ("D") overallVal("D");
} else {
courtesyVal = ("F") || overallVal("F");
}
Appery("courtesy_grade").text(courtesyVal);
Appery("overall_grade").text(overallVal);