Exemple #1
0
 def init_new_detail_record(self, wechat_id, checkin_type):
     # 先判断最新记录是否是True
     stu_id = self.get_stu_id_in_class_list(wechat_id)
     rec = self.get_latest_record(stu_id, checkin_type)
     if rec == {}:
         DetailFile(self.init_detail_name(self.tea_id, self.crs_id, self.seq_id)). \
             write_file([self.get_detail_record(checkin_type, stu_id)], 'ab')
         return
     elif rec['IsSuc'] != 'True':
         DetailFile(self.init_detail_name(self.tea_id, self.crs_id, self.seq_id)). \
             write_file([self.get_detail_record(checkin_type, stu_id)], 'ab')
         return
     else:
         return
Exemple #2
0
 def cancel_leave(self, stu_id):
     dict = {
         'StuID': stu_id,
         'checkinTime': time.strftime('%Y-%m-%d %H:%M:%S'),
         'ProofPath': '',
         'checkinType': 'Auto',
         'IsSuc': 'False',
         'checkinResult': ''
     }
     DetailFile(self.init_detail_name(self.tea_id, self.crs_id, self.seq_id)). \
         write_file([dict], 'ab')
     print 'please finish your check in'
Exemple #3
0
 def start_random_checkin(self, num):
     student_records = self.init_student_records()
     temp_list = random.sample(student_records, num)
     for line in student_records:
         if line in temp_list:
             temp_dict = {
                 'StuID': line['StuID'],
                 'checkinTime': time.strftime('%Y-%m-%d %H:%M:%S'),
                 'ProofPath': 'Auto',
                 'checkinType': 'Random',
                 'IsSuc': 'none',
                 'checkinResult': 'init'
             }
             DetailFile(
                 self.init_detail_name(self.tea_id, self.crs_id,
                                       self.seq_id)).write_file([temp_dict],
                                                                'ab')
Exemple #4
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
Exemple #5
0
    def end_checkin(self):
        detail_file = DetailFile(
            self.init_detail_name(self.tea_id, self.crs_id, self.seq_id))
        for stu in self.init_student_records():
            auto_rec = self.get_latest_record(stu['StuID'], 'Auto')
            ran_rec = self.get_latest_record(stu['StuID'], 'Random')
            # 没有签到的学生 缺勤 追加到文件中
            if auto_rec == {}:
                if ran_rec == {}:
                    auto_rec = {
                        'StuID': stu['StuID'],
                        'checkinTime': time.strftime('%Y-%m-%d %H:%M:%S'),
                        'ProofPath': 'none',
                        'checkinType': 'Auto',
                        'IsSuc': 'False',
                        'checkinResult': '缺勤'
                    }
                    detail_file.write_file([auto_rec], 'ab')
                    continue
                else:
                    auto_rec = ran_rec

            # 签到 并且来的学生 检查是否请假
            if auto_rec != {} and auto_rec['checkinResult'] == '假条提交':
                continue
            # 得到迟到标记,自助考勤最新记录,抽点考勤最新记录
            if ran_rec == {}:
                if auto_rec['IsSuc'] == 'True':
                    auto_rec.update({'checkinResult': self.is_late(auto_rec)})
                else:
                    auto_rec.update({'checkinResult': '缺勤'})
                detail_file.write_file([auto_rec], 'ab')
                continue
            else:
                is_late = True if self.is_late(auto_rec) == '迟到' else False
                auto_rec = self.get_compared_record(auto_rec, ran_rec, is_late)
                detail_file.write_file([auto_rec], 'ab')
        ManCheckin.confirm_leave(self, detail_file)
        self.update_sum()
Exemple #6
0
 def write_detail_file(self, detail_records):
     DetailFile(self.init_detail_name(
         self.tea_id, self.crs_id, self.seq_id)).write_file(detail_records)
     print PrtInfo.successMessage(4)