def createClassList(self, subj, crse): data = self.db.getLessonCount(subj, crse) list = [] for i in data: tempClass = Classes(i[0]) if int(tempClass.rem) > 0: list.append(Classes(i[0])) return list
def modify_score(self, class_name, student_name): """ 修改成绩 :return: """ if not self.has_class(class_name): print('没有该班级') return class_obj = Classes.Classes(class_name) if not class_obj.is_in_class(student_name, 'student'): print('班级没有该学生') return # 设置成绩 score_info = dict() # 成绩信息 score_info['course_name'] = self.teacher_data['course_name'] score = input('成绩:').strip() if not score.isdigit() or int(score) < 0: print('成绩输入无效') return score_info['score'] = int(score) # 更新学生成绩 student_obj = Students.Students(student_name) student_info = student_obj.get_student_info() student_info['score_list'].append(score_info) student_obj.update_student_info(student_info)
def choice_class(self): """ 选班 :return: """ if self.student_data is None: print('先加入学校注册') return # 展示学校的班级信息 方便选择 school_obj = School.School(self.student_data['school_name']) school_obj.show_school_info('class') # 选班 choice = input('输入要选择的班级名:').strip() if not school_obj.is_in_school(choice, 'class'): print('学校没有该班级') return class_obj = Classes.Classes(choice) if class_obj.is_in_class(self.student_data['name'], 'student'): print('已在该班级') return class_obj.add_student(self.student_data['name']) # 学生加入班级 # 关联班级 self.student_data['class_name'] = choice # 关联班级的课程 self.student_data['course_list'] = class_obj.get_all_course() # 更新学生信息 self.update_student_info(self.student_data) print('选班成功')
def show_students(self, class_name): """ 显示班级学生列表 :param class_name: :return: """ class_obj = Classes.Classes(class_name) class_obj.show_student()
def choice_class(self): # 展示所有老师讲课的班级 if not self.show_class_list(): return # 创建班级对象 调用上课方法 choice = input('输入上课班级名:').strip() if not self.has_class(choice): print('没有该班级') return class_obj = Classes.Classes(choice) class_obj.is_teaching(self.teacher_data['name'])
def show_schooling(self, class_name): schooling = 0 if self.is_in_school(class_name, 'class'): class_obj = Classes.Classes(class_name) course_list = class_obj.get_all_course() if len(course_list) <= 0: raise ValueError('班级都没指定课程还想收钱') if len(self.school_data['course_list']) <= 0: raise ValueError('学校都没开课程还想收钱') for i in course_list: for j in self.school_data['course_list']: if j['name'] == i: schooling += j['price'] break return schooling else: raise ValueError('班都没开收什么钱')
def modify_score(self): obj = Teachers.Teachers(self.name) # 展示讲师教的班级列表 if not obj.show_class_list(): return class_name = input('修改哪个班级的成绩:').strip() if not obj.has_class(class_name): print('没有该班级') return # 展示班级学生 class_obj = Classes.Classes(class_name) if not class_obj.show_student(): # 班级没有学生 return student_name = input('选择学生:').strip() if not class_obj.is_in_class(student_name, 'student'): print('班级没有该学生') return obj.modify_score(class_name, student_name)