]> code.communitydata.science - coldcallbot-discord.git/commitdiff
Merge branch 'COM481-2024Q4'
authorBenjamin Mako Hill <mako@atdot.cc>
Sat, 28 Sep 2024 23:27:12 +0000 (16:27 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Sat, 28 Sep 2024 23:27:12 +0000 (16:27 -0700)
1  2 
coldcall.py

diff --cc coldcall.py
index cc5504b529203e36bbb1ba970a98fa9f446516f0,2250fac379fc98b0bfc06a0bb3695e711b3ad837..37b4eb520eec0f3b17a0f3fb54290a2de907eb2c
@@@ -17,15 -21,14 +21,15 @@@ class ColdCall()
          self.record_attendance = record_attendance
  
          # filenames
-         self.__fn_studentinfo = "data/student_information.tsv"
-         self.__fn_daily_calllist = f"data/call_list-{self.today}.tsv"
-         self.__fn_daily_attendance = f"data/attendance-{self.today}.tsv"
-         self.__preferred_name_field = preferred_name_field
+         self.__fn_studentinfo = config["student_info_file"]
+         self.__fn_daily_calllist = config["daily_calllist_file"].format(date=self.today)
+         self.__fn_daily_attendance = config["daily_attendance"].format(date=self.today)
  
-         if preferred_name_field != None:
-             self.preferred_names = self.__get_preferred_names()
+         self.unique_row = config["unique_name_rowname"]
 -        self.preferred_row = config["preferred_name_rowname"]
 -
 -        self.preferred_names = self.__get_preferred_names()
++        if "preferred_name_rowname" in config:
++            self.preferred_row = config["preferred_name_rowname"]
 +        else:
-             self.preferred_names = None
++            self.preferred_row = None
          
      def __load_prev_questions(self):
          previous_questions = defaultdict(int)
  
          # open for appending the student
          with open(self.__fn_daily_calllist, "a") as f:
-             print("\t".join([selected_student, str(datetime.now()),
-                              "MISSING", "MISSING"]), file=f)
+             print("\t".join([selected_student, preferred_name,
+                              "MISSING", "MISSING", str(datetime.now())]), file=f)
  
      def coldcall(self, students_present):
 -        selected_student = self.__select_student_from_list(students_present)
 +        selected_student = self.select_student_from_list(students_present)
  
          # record the called-upon student in the right place
          if self.record_attendance:

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