Skip to content

Commit

Permalink
fix get_scaled_score
Browse files Browse the repository at this point in the history
  • Loading branch information
milt committed Oct 21, 2024
1 parent 59e3372 commit 1b013c4
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 19 deletions.
6 changes: 1 addition & 5 deletions src/transformer/utils/get_scaled_score.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,5 @@
* @return int
*/
function get_scaled_score($rawscore, $minscore, $maxscore) {
if ($rawscore >= 0) {
return $rawscore / $maxscore;
} else {
return $rawscore / $minscore;
}
return (($rawscore - $minscore) / ($maxscore - $minscore) * 2) - 1;
}
2 changes: 1 addition & 1 deletion tests/mod_quiz/attempt_submitted/essay/statements.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_quiz/attempt_submitted/gapselect/statements.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_quiz/attempt_submitted/match/statements.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_quiz/attempt_submitted/numerical/statements.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
2 changes: 1 addition & 1 deletion tests/mod_quiz/attempt_submitted/truefalse/statements.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"raw": 50,
"min": 0,
"max": 100,
"scaled": 0.5
"scaled": 0.0
},
"completion": true,
"success": true,
Expand Down

0 comments on commit 1b013c4

Please sign in to comment.