From 912cfdfc1d6afabe198c3068718f7bf73d20c5e0 Mon Sep 17 00:00:00 2001 From: Sophia Oliinik <105466628+oliiso@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:42:20 -0700 Subject: [PATCH] [Feature:RainbowGrades] Adding hover text to bad status cells (#77) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **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 (https://github.com/Submitty/Submitty/issues/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 <123261952+ziesski@users.noreply.github.com> --- table.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/table.cpp b/table.cpp index e0e2d03..e8f065d 100644 --- a/table.cpp +++ b/table.cpp @@ -72,7 +72,6 @@ TableCell::TableCell(const std::string& c, float d, int precision, const std::st rotate = 0; } - TableCell::TableCell(float d, const std::string& c, int precision, const std::string& n, int ldu, CELL_CONTENTS_STATUS v,const std::string& e,bool ai, const std::string& a, 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 academic_integrity = ai; event = e; - if (reason != "") { - hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension due to "+reason+" on "+gID+"\" "; - } else { - hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension without specified reason on "+gID+"\" "; - } - // Bool in order of priority - top to bottom // Don't think we need this logic, but leaving it as sort of assert if (event == "Overridden"){ @@ -109,6 +102,11 @@ TableCell::TableCell(float d, const std::string& c, int precision, const std::st } else if (event == "Extension"){ extension = true; inquiry = bad_status = override = version_conflict = cancelled = false; + if (reason != ""){ + hoverText = "class=\"hoverable-cell\" data-hover-text=\"" + userName + " received a " + std::to_string(daysExtended) + " day extension due to " + reason + " on " + gID + "\" "; + } else { + hoverText = "class=\"hoverable-cell\" data-hover-text=\""+userName+" received a "+std::to_string(daysExtended)+" day extension without specified reason on "+gID+"\" "; + } } else if (event == "Open"){ inquiry = true; 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 } else if (event == "Bad"){ bad_status = true; override = inquiry = extension = version_conflict = cancelled = false; + hoverText = "class=\"hoverable-cell\" data-hover-text=\"" + userName + " received a bad status on " + gID + "\" "; } else { inquiry = bad_status = override = extension = version_conflict = cancelled = false; } - } @@ -151,11 +149,10 @@ std::ostream& operator<<(std::ostream &ostr, const TableCell &c) { outline = "outline:4px solid #fc0303; outline-offset: -4px;"; } - if (c.extension){ - ostr << ""; + if (c.extension || c.bad_status) { + ostr << ""; } else { - ostr << ""; - + ostr << ""; } if (0) { //rotate == 90) {