Пример #1
0
def choose_course():
    while True:
        # 1、先打印所有学校,并选择
        flag, school_list = common_interface.get_all_school_interface()
        if not flag:
            print(school_list)
            break

        for index, school_name in enumerate(school_list):
            print(f'编号: {index}   学校名: {school_name}')

        choice = input('请输入选择的学校编号: ').strip()
        if not choice.isdigit():
            print('输入有误')
            continue

        choice = int(choice)

        if choice not in range(len(school_list)):
            print('输入编号有误!')
            continue

        # 获取选择的学校名称
        school_name = school_list[choice]

        # 2、从选择的学校中获取所有的课程
        flag2, course_list = common_interface.get_course_in_school_interface(
            school_name)
        if not flag2:
            print(course_list)
            break

        for index2, course_name in enumerate(course_list):
            print(f'编号: {index2}   课程名: {course_name}')

        choice2 = input('请输入选择的课程编号: ').strip()

        if not choice2.isdigit():
            print('输入有误')
            continue

        choice2 = int(choice2)

        if choice2 not in range(len(course_list)):
            print('输入编号有误!')
            continue

        # 获取选择的课程名称
        course_name = course_list[choice2]

        # 3、调用选择教授课程接口,将该课程添加到老师课程列表中
        flag3, msg = teacher_interface.add_course_interface(
            course_name, teacher_info.get('user'))
        if flag3:
            print(msg)
            break
        else:
            print(msg)
Пример #2
0
def choose_course():
    while True:
        # 1.先打印所有学校,并选择
        flag, school_list = common_interface.get_all_school_interface()
        if not flag:
            print(school_list)
            break

        for index, school_name in enumerate(school_list):
            print(f'编号:{index}  学校名:{school_name}')

        choice = input('请输入选择的学校编号:').strip()

        if not choice.isdigit():
            print('输入错误,请重新输入')
            continue

        choice = int(choice)
        if choice not in range(len(school_list)):
            print('输入超出范围,请重新输入')
            continue
        # 获取选择的学校名称
        school_name = school_list[choice]

        # 2.从选择的学校中获取所有的课程
        flag2, course_list = common_interface.get_course_in_school_interface(school_name)
        if not flag2:
            print(course_list)
            break
        for index, course_name in enumerate(school_list):
            print(f'编号:{index}   课程名:{school_name}')

        choice2 = input('请输入选择的课程编号:').strip()
        if not choice2.isdigit():
            print('输入有误')
            continue
        choice2 = int(choice2)

        if choice2 not in range(len(course_list)):
            print('输入有误')
            continue
        course_name = course_list[choice2]

        # 3.调用选择教授课程接口,将该课程添加到老师课程列表中
        teacher_interface.add_course_interface(course_name, teacher_info.get('user'))
Пример #3
0
def choice_course():
    while True:
        # 获取想要授课的校区
        sch_flag, sch_list_msg = common_interface.get_all_school_interface()
        if not sch_flag:
            print(sch_list_msg)

        for index, school_name in enumerate(sch_list_msg):
            print(f'编号: {index}    学校名: {school_name}')

        choice_sch = input('请输入选择的学校编号').strip()

        if not choice_sch.isdigit():
            print('请输入合法指令')
            continue

        choice_sch = int(choice_sch)
        if choice_sch not in range(len(sch_list_msg)):
            print('请输入合法指令')
            continue

        # 获取学校下有哪些课程,并打印出该校区课程信息
        school_name = sch_list_msg[choice_sch]
        cou_flag, course_list_msg = common_interface.get_all_course_interface(
            school_name=school_name)
        for index, course_name in enumerate(course_list_msg):
            print(f'编号: {index}    学校名: {course_name}')

        if not cou_flag:
            print(course_list_msg)

        choice_cou = input('请输入选择的课程编号:').strip()

        if not choice_cou.isdigit():
            print('请输入合法指令')
            continue

        choice_cou = int(choice_cou)
        if choice_cou not in range(len(course_list_msg)):
            print('请输入有效课程编号')
            continue

        course_name = course_list_msg[choice_cou]
        flag, msg = teacher_interface.add_course_interface(
            school_name=school_name,
            course_name=course_name,
            login_user=teacher_info.get('user'))

        if flag:
            print(msg)
            break
        else:
            print(msg)
            break
Пример #4
0
def choose_course():
    while True:
        #1.打印所有学校供选择
        flag, school_list_or_msg = common_interface.get_all_school_interface()
        if not flag:
            print(school_list_or_msg)
            break
        for index, school_name in enumerate(school_list_or_msg):
            print(f'编号{index},学校名称{school_name}')

        choice = input('请输入你的选择:').strip()
        if not choice.isdigit():
            print('输入有误')
            continue
        choice = int(choice)

        if choice not in range(len(school_list_or_msg)):
            print('输入的编号有误')
            continue

        school_name = school_list_or_msg[choice]

        flag2, course_list_or_msg = common_interface.get_course_in_school_interface(
            school_name)
        if not flag2:
            print(course_list_or_msg)
            break

        for index2, course_name in enumerate(course_list_or_msg):
            print(f'编号:{index} 课程名称:{course_name}')

        choice2 = input('请输入你的选择:').strip()
        if not choice2.isdigit():
            print('输入有误')
            continue

        choice2 = int(choice2)

        if choice2 not in range(len(course_list_or_msg)):
            print('输入有误')
            continue

        course_name = course_list_or_msg[choice2]

        flag3, msg3 = teacher_interface.add_course_interface(
            course_name, teacher_info.get('user'))

        if flag3:
            print(msg3)
            break
        else:
            print(msg3)
Пример #5
0
def chosse_course():
    #获取学校的名字
    while True:
        flag, school_list = common_interface.get_all_school_interface()
        if not flag:
            print(school_list)
            break
        for index, school_name in enumerate(school_list):
            print("编号%s,学校%s" % (index, school_name))
        choices = input("请输入编号").strip()
        if not choices.isdigit():
            print("请输入数字")
            continue
        choices = int(choices)
        if choices not in range(len(school_list)):
            print("请输入正确的编号")
            continue
        school_name = school_list[choices]
        #2 从选择学校里获取所有课程
        flag2, couse_list = common_interface.get_course_in_school_interface(
            school_name)
        print(couse_list)
        if not flag2:
            print(couse_list)
            break
        for index2, couse_list2 in enumerate(couse_list):
            print("编号%s,课程%s" % (index2, couse_list2))
        choices2 = input("请输入编号").strip()
        if not choices2.isdigit():
            print("请输入数字")
            continue
        choices2 = int(choices2)
        if choices2 not in range(len(couse_list)):
            print("请输入正确的编号")
            continue
        #选择课程的名字
        couse_name = couse_list[choices2]
        print(couse_name)

        #调用接口,将课程添加到列表中
        flag3, mag3 = teacher_interface.add_course_interface(
            couse_name, teacher_info.get("user"))
        if flag:
            print(mag3)
            break
        else:
            print(mag3)
Пример #6
0
def choose_course():
    while True:
        flag, school_list = common_interface.get_all_schools_interface()
        if not flag:
            print(school_list)
            break
        for index, school_name in enumerate(school_list):
            print(f'编号:{index}   学校名:{school_name}')

        choice = input('请输入学校编号').strip()
        if not choice.isdigit():
            print('请输入数字编号')
            continue

        choice = int(choice)
        if choice not in range(len(school_list)):
            print('请输入正确编号')
            continue

        school_name = school_list[choice]
        flag, course_list = common_interface.get_all_courses_school(school_name)
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号:{index}   课程名称:{course_name}')

        choice2 = input('请输入课程编号').strip()
        if not choice2.isdigit():
            print('请输入数字编号')
            continue

        choice2 = int(choice2)
        if choice2 not in range(len(course_list)):
            print('请输入正确编号')
            continue
        course_name = course_list[choice2]
        flag, msg = teacher_interface.add_course_interface(course_name, teacher_info['user'])
        if flag:
            print(msg)
            break
        else:
            print(msg)
Пример #7
0
def choice_course():
    while True:
        flag, school_list = common_interface.get_all_school_interface()
        if not flag:
            print(school_list)
            break
        for index, school_name in enumerate(school_list):
            print(f'学校编号为:[{index}], 学校名称为:[{school_name}]')

        choice = input('请输入选择的学校编号==>').strip()
        if not choice.isdigit():
            print('输入有误!')
            continue
        choice = int(choice)
        if choice not in range(len(school_list)):
            print('输入有误!')
            continue
        school_name = school_list[choice]

        flag2, course_list = common_interface.get_course_in_school_interface(
            school_name)
        if not flag2:
            print(course_list)
            break
        for index2, course_name in enumerate(course_list):
            print(f'课程编号为:[{index2}], 课程名称为:[{course_name}]')
        choice2 = input('请输入选择的课程编号==>').strip()
        if not choice2.isdigit():
            print('输入有误!')
            continue
        choice2 = int(choice2)
        if choice2 not in range(len(course_list)):
            print('输入课程编号有误!')
            continue
        course_name = course_list[choice2]

        flag3, msg = teacher_interface.add_course_interface(
            course_name, teacher_info['user'])
        if flag3:
            print(msg)
            break
        else:
            print(msg)