Example #1
0
 def get_stu_id_in_class_list(self, wechat_id):
     student_records = self.init_student_records()
     for stu_rec in student_records:
         if stu_rec['WeChatID'] == wechat_id:
             return stu_rec['StuID']
     else:
         print PrtInfo.notFoundMessage(3)
         return None
Example #2
0
 def update_stu_detail_checkin_result(stu_id, seq_id,tea_id,crs_id):
     detail_records = BaseFile.read_file(BaseCheckin.init_detail_name(tea_id,crs_id, seq_id))
     for detail_rec in detail_records:
         if detail_rec['StuID'] == str(stu_id):
             if detail_rec['checkinResult'] == '请假提交':
                 if raw_input(PrtInfo.promptMessage(4)) == 'y' | 'Y':
                     detail_rec['checkinResult'] = '请假'
                 else:
                     detail_rec['checkinResult'] = '缺勤'
             detail_rec['IsSuc'] = 'True'
             detail_rec['checkinResult'] = raw_input(PrtInfo.promptMessage(4))
             print PrtInfo.successMessage(0)+detail_rec['checkinResult']
             detail_file = DetailFile(BaseCheckin.init_detail_name(tea_id, crs_id, seq_id))
             detail_file.write_file([detail_rec],'ab')
             return True
     print PrtInfo.notFoundMessage(3)
     return False
Example #3
0
 def init_course_id_by_wechatid(wechat_id):
     tea_id = BaseCheckin.init_teacher_id_by_wechatid(wechat_id)
     crs_id_list = []
     crs_records = BaseFile.read_file(BaseCheckin.course_file.name)
     for record in crs_records:
         if (record['TeacherID'] == tea_id) & (record['CourseID']
                                               not in crs_id_list):
             crs_id_list.append(record['CourseID'])
     if crs_id_list == []:
         print PrtInfo.notFoundMessage(1)
         return 0
     while True:
         crs_id_list.append('back')
         f = Form(['Course ID'], crs_id_list)
         c = f.init_form()
         if c == len(crs_id_list):
             return 0
         else:
             return f.items[c - 1]
Example #4
0
 def find_checkin_obj_with_wechat_id(wechat_id):
     if BaseCheckin.checkin_list == []:
         print PrtInfo.failedMessage(0)
         return None
     else:
         print PrtInfo.promptMessage(10)
         tea_ids = []
         for i in BaseCheckin.checkin_list:
             tea_ids.append(i.tea_id)
         choice = Form(['teacher id'], tea_ids).init_form()
         if choice == -1:
             return None
         tea_id = tea_ids[choice - 1]
         for i in BaseCheckin.checkin_list:
             if i.tea_id == tea_id:
                 if i.get_stu_id_in_class_list(wechat_id) != None:
                     return i
                 else:
                     print PrtInfo.notFoundMessage(4)
                     return None
         else:
             print PrtInfo.failedMessage(0)
             return None
Example #5
0
 def join_checkin(self, wechat_id):
     if self in BaseCheckin.checkin_list:
         checkin_type = raw_input(PrtInfo.promptMessage(6))
         if checkin_type == 'Auto':
             self.init_new_detail_record(wechat_id, 'Auto')
             PrtInfo.successMessage(8)
             return True
         elif checkin_type == 'Random':
             random_list = self.get_random_list()
             if random_list == []:
                 print 'No random check in now'
                 return False
             if self.get_stu_id_in_class_list(wechat_id) not in random_list:
                 print PrtInfo.notFoundMessage(4)
                 return False
             else:
                 self.init_new_detail_record(wechat_id, 'Random')
                 PrtInfo.successMessage(8)
         else:
             print PrtInfo.failedMessage(1)
     else:
         print PrtInfo.failedMessage(0)
         return False