3 from coldcall import ColdCall
4 from datetime import datetime
5 from csv import DictReader
7 current_time = datetime.today()
9 ## create the coldcall object
10 cc = ColdCall(record_attendance=False, preferred_name_field="Name you'd like to go by in class")
12 def get_missing(d=current_time):
13 date_string = f'{d.month}/{d.day}/{d.year}'
14 with open("data/absence_poll_data.tsv", 'r') as f:
15 for row in DictReader(f, delimiter="\t"):
16 if row["Date of class session you will be absent"] == date_string:
17 yield(row["Your UW student number"])
20 registered_students = []
21 with open("data/2022_winter_COM_481_A_students.csv", 'r') as f:
22 for row in DictReader(f, delimiter=","):
23 student_no = row["StudentNo"].strip()
24 registered_students.append(student_no)
25 full_names[student_no] = f"{row['FirstName']} {row['LastName']}"
26 ## print("Registered:", registered_students)
28 missing_today = [x for x in get_missing(current_time)]
29 ## print("Missing Today: ", missing_today)
32 with open("data/student_information.tsv", 'r') as f:
33 for row in DictReader(f, delimiter="\t"):
34 preferred_names[row["Your UW student number"]] = row["Name you'd like to go by in class"]
35 ## print("Preferred names:", preferred_names)
37 students_present = [s for s in registered_students if s not in missing_today]
38 ## print("Students present:", students_present)
41 selected_student = cc.select_student_from_list(students_present)
44 preferred_name = preferred_names[selected_student]
46 preferred_name = "MISSING PREFERRED NAME"
50 selected_student, "::",
51 full_names[selected_student])
52 cc.record_coldcall(selected_student)