Skip to content

Commit 912cfdf

Browse files
oliisoziesski
andauthored
[Feature:RainbowGrades] Adding hover text to bad status cells (#77)
**What is the current behavior?** Students aren't sure what the red outline on the grade report means since the description is at the bottom of the grade report page. **What is the new behavior?** A hover feature is now implemented to notify that the red outline cells are bad status, including the username of the student with a bad status and the homework/assignment that a bad status was received. **Other information?** Fixes #10439 (Submitty/Submitty#10439) When the cursor is over the bad status cell this is the hover text that appears: ![Image 7-1-24 at 3 55 PM](https://github.com/Submitty/RainbowGrades/assets/105466628/a4cf5eb1-e036-4806-817e-c246fee9f424) --------- Co-authored-by: Jaeseok Kang <[email protected]>
1 parent 35e52ac commit 912cfdf

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

table.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ TableCell::TableCell(const std::string& c, float d, int precision, const std::st
7272
rotate = 0;
7373
}
7474

75-
7675
TableCell::TableCell(float d, const std::string& c, int precision, const std::string& n, int ldu,
7776
CELL_CONTENTS_STATUS v,const std::string& e,bool ai, const std::string& a,
7877
int s, int /*r*/,const std::string& reason,const std::string& gID,const std::string& userName, int daysExtended) {
@@ -95,12 +94,6 @@ TableCell::TableCell(float d, const std::string& c, int precision, const std::st
9594
academic_integrity = ai;
9695
event = e;
9796

98-
if (reason != "") {
99-
hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension due to "+reason+" on "+gID+"\" ";
100-
} else {
101-
hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension without specified reason on "+gID+"\" ";
102-
}
103-
10497
// Bool in order of priority - top to bottom
10598
// Don't think we need this logic, but leaving it as sort of assert
10699
if (event == "Overridden"){
@@ -109,6 +102,11 @@ TableCell::TableCell(float d, const std::string& c, int precision, const std::st
109102
} else if (event == "Extension"){
110103
extension = true;
111104
inquiry = bad_status = override = version_conflict = cancelled = false;
105+
if (reason != ""){
106+
hoverText = "class=\"hoverable-cell\" data-hover-text=\"" + userName + " received a " + std::to_string(daysExtended) + " day extension due to " + reason + " on " + gID + "\" ";
107+
} else {
108+
hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension without specified reason on "+gID+"\" ";
109+
}
112110
} else if (event == "Open"){
113111
inquiry = true;
114112
bad_status = override = extension = version_conflict = cancelled = false;
@@ -121,10 +119,10 @@ TableCell::TableCell(float d, const std::string& c, int precision, const std::st
121119
} else if (event == "Bad"){
122120
bad_status = true;
123121
override = inquiry = extension = version_conflict = cancelled = false;
122+
hoverText = "class=\"hoverable-cell\" data-hover-text=\"" + userName + " received a bad status on " + gID + "\" ";
124123
} else {
125124
inquiry = bad_status = override = extension = version_conflict = cancelled = false;
126125
}
127-
128126
}
129127

130128

@@ -151,11 +149,10 @@ std::ostream& operator<<(std::ostream &ostr, const TableCell &c) {
151149
outline = "outline:4px solid #fc0303; outline-offset: -4px;";
152150
}
153151

154-
if (c.extension){
155-
ostr << "<td " << c.hoverText << "style=\"border:1px solid #aaaaaa; background-color:#" << c.color << "; " << outline << " \" align=\"" << c.align << "\">";
152+
if (c.extension || c.bad_status) {
153+
ostr << "<td " << c.hoverText << "style=\"border:1px solid #aaaaaa; background-color:#" << c.color << "; " << outline << "\" align=\"" << c.align << "\">";
156154
} else {
157-
ostr << "<td style=\"border:1px solid #aaaaaa; background-color:#" << c.color << "; " << outline << " \" align=\"" << c.align << "\">";
158-
155+
ostr << "<td style=\"border:1px solid #aaaaaa; background-color:#" << c.color << "; " << outline << "\" align=\"" << c.align << "\">";
159156
}
160157

161158
if (0) { //rotate == 90) {

0 commit comments

Comments
 (0)