]> code.communitydata.science - coldcallbot-discord.git/blobdiff - coldcall.py
print preferred pronouns in the call list
[coldcallbot-discord.git] / coldcall.py
index 37b4eb520eec0f3b17a0f3fb54290a2de907eb2c..3fb79d663c7c694b751710e48ad0f64a8bbaaf13 100644 (file)
@@ -16,6 +16,7 @@ class ColdCall():
             config = json.loads(config_file.read())
 
         self.today = str(datetime.date(datetime.now()))
             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
         # 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
 
 
         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
 
         # 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):
         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
 
         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)
                 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:
 
         # open for appending the student
         with open(self.__fn_daily_calllist, "a") as f:

Community Data Science Collective || Want to submit a patch?