Skip to content

Commit 4b91219

Browse files
ziesskiKConybmcutler
authored
[Refactor:RainbowGrades] Student.cpp tolerance (#64)
Forgot one print debugging statement, and tolerance padding for assertion was missing (Related #62 ) --------- Co-authored-by: Konstantin Kuzmin <kkouzmin@mail.ru> Co-authored-by: Barb Cutler <bmcutler@users.noreply.github.com>
1 parent db9d68d commit 4b91219

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
*.log
99
*.out
1010
*.synctex.gz
11+
/.idea/

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/RainbowGrades.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

student.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ float Student::GradeablePercent(GRADEABLE_ENUM g) const {
272272
sum_percentage += p;
273273
}
274274
}
275-
assert(sum_percentage <= 1.0);
275+
const float tolerance = 0.000001;
276+
assert(sum_percentage <= 1.0 + tolerance);
276277
if (sum_max == 0) { // pure extra credit category
277278
sum_percentage = 1.0;
278279
}
@@ -442,9 +443,7 @@ float Student::overall_b4_academic_sanction() const {
442443
std::string Student::grade(bool flag_b4_academic_sanction, Student *lowest_d) const {
443444

444445
if (section == "null") return "";
445-
446446
if (!flag_b4_academic_sanction && manual_grade != "") return manual_grade;
447-
448447
float over = overall();
449448
if (flag_b4_academic_sanction) {
450449
over = overall_b4_academic_sanction();

0 commit comments

Comments
 (0)