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
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()