Beispiel #1
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
Beispiel #2
0
def stu_menu():
    subprocess.call("clear")
    wechat_id = raw_input(PrtInfo.promptMessage(0))
    while True:
        m = StudentForm()
        c = m.init_form()
        if c == 1:
            join_checkin_menu(wechat_id)
        if c == 2:
            subprocess.call("clear")
            break
Beispiel #3
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
Beispiel #4
0
def tea_menu():
    subprocess.call("clear")
    wechat_id = raw_input(PrtInfo.promptMessage(0))
    while True:
        m = TeacherForm()
        c = m.init_form()
        if c == 1:
            start_menu(wechat_id)
        if c == 2:
            update_menu(wechat_id)
        if c == 3:
            history_menu(wechat_id)
        if c == 4:
            progress_menu(wechat_id)
        if c == 5:
            subprocess.call("clear")
            break
Beispiel #5
0
 def confirm_leave(obj,detail_file):
     records = BaseFile.read_file(detail_file.name)
     leave_list = []
     for rec in records:
         if rec['checkinResult'] == '假条提交':
             leave_list.append(rec)
     if leave_list is not []:
         print 'You have ' + str(leave_list.__len__()) + ' leave events to handle!'
         for line in leave_list:
             print 'Name:' + BaseCheckin.get_student_name(obj,line['StuID'])
             print 'Image:' + line['ProofPath']
             choice = raw_input(PrtInfo.promptMessage(8))
             if choice == 'y':
                 print line['ProofPath']
                 line['checkinResult'] = '请假'
             else:
                 print line['ProofPath']
                 line['checkinResult'] = '缺勤'
             detail_file.write_file([line], 'ab')
Beispiel #6
0
def update_once_checkin(wechat_id):
    subprocess.call("clear")
    while True:
        obj = ManCheckin(wechat_id)
        if obj.tea_id == 0:
            print PrtInfo.failedMessage(4)
            prompt = raw_input('maybe try again?(y/n)')
            if prompt == 'n':
                break
        else:
            r = range(1, obj.init_seq_id(obj.tea_id, obj.crs_id))
            r.append('exit')
            c = Form(['seq id'], r)
            seq_id = c.init_form()
            if seq_id == len(r) or seq_id == -1:
                break
            detail_records = DetailFile.read_file(
                BaseCheckin.init_detail_name(obj.tea_id, obj.crs_id, seq_id))
            detail_format(detail_records)
            stu_id = raw_input(PrtInfo.promptMessage(3))
            obj.update_stu_detail_checkin_result(stu_id, seq_id, obj.tea_id,
                                                 obj.crs_id)
            break
Beispiel #7
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
Beispiel #8
0
 def upload_path(self):
     return raw_input(PrtInfo.promptMessage(5))