def edit_training_level(name, value): student = None student = Student.objects(name=name).first() if student: student.train(value) return True else: return False
def edit_training_level(name,value): student = None student = Student.objects(name=name).first() if student: value.strip() value = value.split(',') for val in value: num = val.strip() student.train(num) return True else: return False
def PastDueTools(): out = [] for student in Student.objects(): if student.checked_out_tools: for tool in student.checked_out_tools: toolname = tool.split(',') tool_object = svc.find_tool(toolname[0], toolname[1]) use = tool_object.usages[-1] date_time_str = use.ReturnDateExpect date_time_obj = datetime.datetime.strptime( str(date_time_str), '%Y-%m-%d') today = datetime.date.today() delta = date_time_obj.date() - today if int(delta.days) < 0: out.append(student.name + ': -> ') out.append(toolname[0] + ' ' + toolname[1] + ' ') out.append('past due: ' + str(delta.days) + ' days\n') return out
def find_student_by_studentID(studentID: str) -> Student: student = Student.objects(studentID=studentID).first() return student