I am in possession of a dataset that shows the proportion of each test contributing to the final grade. In cases where a student has missed one or more tests, the weight is redistributed accordingly among the tests they did take. I want to determine how to calculate the new proportions for each test taken by a particular student. Is there a method to compare arrays and array objects to identify which tests were missed by a student? When it comes to recalculating the revised proportions, rather than using an if
statement, is there a more efficient approach that can be considered? Appreciate any suggestions! Thank you!
testPercentage = {"A":0.5,"B":0.3,"C":0.15,"D":0.05};
maryTest = ["A", "B"];
Revised test percentage for Mary would now be:
A = 0.5/(1-0.15-0.05)
B = 0.3/(1-0.15-0.05)
if (maryTest.length == 1){
//assuming Mary only took test A
A = 1
}
if (maryTest.length == 2){
A = 0.5 + (0.5/(1-the proportion of those two tests she missed))
B = 0.3 + (0.3/(1-the proportion of those two tests she missed))
}
if (maryTest.length == 3){
//
}
if (maryTest.length == 4){
// same as testPercentage
}