X-Git-Url: https://code.communitydata.science/coldcallbot-discord.git/blobdiff_plain/d6b74612e3a2f01112fa14c6c86bec9c20093ed3..da93d3fd56f78a67c1f109f4c72f3fcf35fbc102:/coldcall.py diff --git a/coldcall.py b/coldcall.py index 37b4eb5..3fb79d6 100644 --- a/coldcall.py +++ b/coldcall.py @@ -16,6 +16,7 @@ class ColdCall(): config = json.loads(config_file.read()) self.today = str(datetime.date(datetime.now())) + # how much less likely should it be that a student is called upon? self.weight = 2 self.record_attendance = record_attendance @@ -43,7 +44,7 @@ class ColdCall(): return previous_questions - def __get_preferred_names(self): + def get_preferred_names(self): # translate the unique name into the preferred students name, # if possible, otherwise return the unique name @@ -55,8 +56,9 @@ class ColdCall(): return(preferred_names) def __get_preferred_name(self, selected_student): - if selected_student in self.preferred_names: - return self.preferred_names[selected_student] + preferred_names = self.get_preferred_names() + if selected_student in preferred_names: + return preferred_names[selected_student] else: return None @@ -94,6 +96,8 @@ class ColdCall(): print("\t".join([self.unique_row, self.preferred_row, "answered", "assessment", "timestamp"]), file=f) preferred_name = self.__get_preferred_name(selected_student) + if preferred_name == None: + preferred_name = "" # open for appending the student with open(self.__fn_daily_calllist, "a") as f: