Skip to content

Commit d785271

Browse files
committed
fix scoring logic
1 parent ecdd246 commit d785271

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

extras/scripts/attendance.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import pandas as pd
22

33
NUM_CLASSES = 7
4-
TOP_SCORE = NUM_CLASSES
54
FREEBIES = 1
5+
TOP_SCORE = NUM_CLASSES - FREEBIES
66

77
ROLL_CALL_CSV = (
88
"~/Downloads/attendance_reports_attendance-264e4d14-1765-4396-b311-4d927b59566d.csv"
@@ -70,11 +70,10 @@ def compute_scores(entries: pd.DataFrame):
7070
# print_heading("Attendance counts")
7171
# print_students(attendance_counts)
7272

73-
# factor in the freebies
74-
scores = attendance_counts + FREEBIES
75-
scores[scores > TOP_SCORE] = TOP_SCORE
73+
# cap the top scores
74+
attendance_counts[attendance_counts > TOP_SCORE] = TOP_SCORE
7675

77-
return scores
76+
return attendance_counts
7877

7978

8079
def write_canvas_csv(scores: pd.Series):
@@ -108,7 +107,7 @@ def run():
108107
print_students(scores)
109108

110109
lowered_scores = scores[scores < TOP_SCORE]
111-
print_heading(f"Scores for students who missed more than {FREEBIES} class(es)")
110+
print_heading(f"Scores below {TOP_SCORE}")
112111
print_students(lowered_scores.sort_values())
113112

114113
write_canvas_csv(scores)

0 commit comments

Comments
 (0)