17
0

updated cold call script to do a pure shuffle

- this will just just produce the students present for the day, in random order
This commit is contained in:
Benjamin Mako Hill 2024-10-27 15:59:14 -07:00
parent 44868248db
commit f7270293f2

View File

@ -3,7 +3,19 @@
from coldcall import ColdCall
from datetime import datetime
from csv import DictReader
from random import sample
import json
import argparse
parser = argparse.ArgumentParser(description='run the coldcall bot manually to create a coldcall list')
parser.add_argument('-n', '--num', dest="num_calls", default=100, const=100, type=int, nargs='?',
help="how many students should be called")
parser.add_argument('-s', '--shuffle', dest="shuffle_roster", action="store_true",
help="select without replacement (i.e., call each person once with n equal to the group size)")
args = parser.parse_args()
current_time = datetime.today()
with open("configuration.json") as config_file:
@ -44,8 +56,12 @@ preferred_names = cc.get_preferred_names()
students_present = [s for s in registered_students if s not in missing_today]
# print("Students present:", students_present) # useful for debug
for i in range(100):
selected_student = cc.select_student_from_list(students_present)
def print_selected(selected_student):
if "print_index" in globals():
global print_index
else:
global print_index
print_index = 1
try:
preferred_name = preferred_names[selected_student]
@ -56,8 +72,23 @@ for i in range(100):
pronouns = preferred_pronouns[selected_student]
else:
pronouns = "[unknown pronouns]"
print(f"{i + 1}. {preferred_name} :: {pronouns} :: {full_names[selected_student]} :: {selected_student}")
print(f"{print_index}. {preferred_name} :: {pronouns} :: {full_names[selected_student]} :: {selected_student}")
cc.record_coldcall(selected_student)
print_index += 1 ## increase the index
# if we're in suffle mode
shuffle = args.shuffle_roster
print_index = 1
if shuffle:
for selected_student in sample(students_present, len(students_present)):
print_selected(selected_student)
else:
num_calls = args.num_calls
for i in range(num_calls):
selected_student = cc.select_student_from_list(students_present)
print_selected(selected_student)