Spaces:
Sleeping
Sleeping
Enhance grade messaging logic to handle conditional grades and improve numeric comparisons for performance feedback
Browse files
app.py
CHANGED
|
@@ -177,17 +177,29 @@ def main():
|
|
| 177 |
else:
|
| 178 |
st.write(remarks)
|
| 179 |
|
|
|
|
| 180 |
if not pd.isna(grade):
|
| 181 |
-
if grade
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
elif grade > 3.00:
|
| 186 |
-
message = f"Your grade of {grade:.2f} indicates that you did not meet the passing requirements. Please consult with your instructor to discuss options for improvement and potential remediation."
|
| 187 |
st.markdown(f"<p class='message'>{message}</p>", unsafe_allow_html=True)
|
| 188 |
else:
|
| 189 |
-
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
|
| 192 |
if remarks == "Conditional":
|
| 193 |
warning_message = "Warning: Your current status is Conditional. You need to pass or achieve a higher grade in the final term to improve your standing."
|
|
|
|
| 177 |
else:
|
| 178 |
st.write(remarks)
|
| 179 |
|
| 180 |
+
# Handle grade messages
|
| 181 |
if not pd.isna(grade):
|
| 182 |
+
# Check if grade is "-" (conditional)
|
| 183 |
+
if str(grade).strip() == "-":
|
| 184 |
+
message = "Your grade is currently marked as Conditional. This means your final standing will depend on your performance in the final term. Work hard to achieve a passing grade!"
|
|
|
|
|
|
|
|
|
|
| 185 |
st.markdown(f"<p class='message'>{message}</p>", unsafe_allow_html=True)
|
| 186 |
else:
|
| 187 |
+
# Try to convert grade to float for numeric comparisons
|
| 188 |
+
try:
|
| 189 |
+
grade_numeric = float(grade)
|
| 190 |
+
if grade_numeric >= 1.9 and grade_numeric <= 3.0:
|
| 191 |
+
message = f"Keep up the good work! Your grade of {grade_numeric:.2f} shows dedication. Consider seeking additional support to further improve your performance."
|
| 192 |
+
st.markdown(f"<p class='message'>{message}</p>", unsafe_allow_html=True)
|
| 193 |
+
|
| 194 |
+
elif grade_numeric > 3.00:
|
| 195 |
+
message = f"Your grade of {grade_numeric:.2f} indicates that you did not meet the passing requirements. Please consult with your instructor to discuss options for improvement and potential remediation."
|
| 196 |
+
st.markdown(f"<p class='message'>{message}</p>", unsafe_allow_html=True)
|
| 197 |
+
else:
|
| 198 |
+
message = f"Congratulations! Your outstanding grade of {grade_numeric:.2f} demonstrates exceptional performance. Keep up the excellent work!"
|
| 199 |
+
st.markdown(f"<p class='message'>{message}</p>", unsafe_allow_html=True)
|
| 200 |
+
except (ValueError, TypeError):
|
| 201 |
+
# If grade cannot be converted to float, skip numeric comparison
|
| 202 |
+
pass
|
| 203 |
|
| 204 |
if remarks == "Conditional":
|
| 205 |
warning_message = "Warning: Your current status is Conditional. You need to pass or achieve a higher grade in the final term to improve your standing."
|