Skip to content

Commit 14834c3

Browse files
authored
[Refactor:RainbowGrades] Edit Moss Default Value (#58)
The current mossify function assumes average_letter_grade to be greater than 0. moss_penalty += -average_letter_grade * penalty; s->getMossPenalty() < -0.01 is the threshold to check if student has moss penalty. However, if value of average_letter_grade or penalty is 0, it does not pass the threshold and does not catch the student when displaying the black outline or adding @ to final grade. Hence, quick fix made by increasing the default moss_penalty from -0.0000001 -> -0.0000002
1 parent 746c38f commit 14834c3

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

output.cpp

+11-10
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ void start_table_output( bool /*for_instructor*/,
946946
if (DISPLAY_FINAL_GRADE) {
947947
std::string g = this_student->grade(false,sd);
948948
color = GradeColor(g);
949-
if (this_student->getMossPenalty() < -0.01) {
949+
if (this_student->getMossPenalty() < -0.00000001) {
950950
g += "@";
951951
}
952952
assert (color.size()==6);
@@ -1175,6 +1175,16 @@ void end_table(std::ofstream &ostr, bool for_instructor, Student *s) {
11751175

11761176
ostr << "<p>* = 1 late day used</p>" << std::endl;
11771177

1178+
1179+
bool print_moss_message = false;
1180+
if (s != NULL && s->getMossPenalty() < -0.0000001) {
1181+
print_moss_message = true;
1182+
}
1183+
1184+
if (print_moss_message) {
1185+
ostr << "@ = Academic Integrity Violation penalty<p>&nbsp;<p>\n";
1186+
}
1187+
11781188
// Description of border outline that are in effect
11791189
if (s != NULL)
11801190
{
@@ -1232,7 +1242,6 @@ void end_table(std::ofstream &ostr, bool for_instructor, Student *s) {
12321242
}
12331243

12341244

1235-
12361245
if (s != NULL) {
12371246
std::ifstream istr("student_poll_reports/"+s->getUserName()+".html");
12381247
if (istr.good()) {
@@ -1244,14 +1253,6 @@ void end_table(std::ofstream &ostr, bool for_instructor, Student *s) {
12441253
}
12451254
ostr << "<p>&nbsp;<p>\n";
12461255

1247-
bool print_moss_message = false;
1248-
if (s != NULL && s->getMossPenalty() < -0.01) {
1249-
print_moss_message = true;
1250-
}
1251-
1252-
if (print_moss_message) {
1253-
ostr << "@ = final grade with Academic Integrity Violation penalty<p>&nbsp;<p>\n";
1254-
}
12551256

12561257
if (DISPLAY_FINAL_GRADE) { // && students.size() > 50) {
12571258

student.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void Student::mossify(const std::string &gradeable, float penalty) {
488488
// but it will be multiplied by a negative and added to the total;
489489
assert (penalty >= 0);
490490

491-
moss_penalty += -0.0000001;
491+
moss_penalty += -0.0000002;
492492
moss_penalty += -average_letter_grade * penalty;
493493
std::stringstream foo;
494494
foo << std::setprecision(2) << std::fixed << penalty;

0 commit comments

Comments
 (0)