Example #1
0
def check_stu_from_course():
    while True:
        # 1.先获取当前老师下所有的课程
        flag, course_list = teacher_interface.check_course_interface(teacher_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2.打印所有课程,并让老师选择
        for index, course_name in enumerate(course_list):
            print(f'编号:{index}    课程名:{course_name}')

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

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

        choice = int(choice)

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

        # 3.获取选择的课程名称
        course_name = course_list[choice]

        # 4.利用当前课程名称获取所有学生
        flag2, studemt_list = teacher_interface.get_student_interface(course_name, teacher_info.get('user'))

        print(studemt_list)
        break
Example #2
0
def check_stu_from_course():
    while True:
        #查看教授的课程
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info.get("user"))
        if flag:
            print(course_list)
        else:
            print(course_list)
        for index, course_name in enumerate(course_list):
            print("编号%s,课程%s" % (index, course_name))
        choices = input("请输入编号").strip()
        if not choices.isdigit():
            print("请输入数字")
            continue
        choices = int(choices)
        if choices not in range(len(course_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        course_name = course_list[choices]
        print(course_name)
        print(teacher_info.get("user"))
        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info.get("user"))
        if flag2:
            print(student_list, "222")
            break
        else:
            print(student_list, "11")
            break
Example #3
0
def check_stu_from_course():
    while True:
        #1.列出当前老师所有课程供老师选择
        flag, course_list_or_msg = teacher_interface.check_course_interface(
            teacher_info.get('user'))
        if not flag:
            print(course_list_or_msg)
            break

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

        choice = input('请输入你的选择:').strip()

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

        choice = int(choice)

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

        course_name = course_list_or_msg[choice]

        #2.列出选择的课程下所有学生
        flag, student_list_or_msg = teacher_interface.get_student_interface(
            course_name, teacher_info.get('user'))
        if flag:
            print(student_list_or_msg)
            break
        else:
            print(student_list_or_msg)
Example #4
0
def check_stu_from_course():
    while True:
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号为:[{index}], 课程名称为:[{course_name}]')
        choice = input('请输入选择的课程编号==>').strip()
        if not choice.isdigit():
            print('输入有误!')
            continue
        choice = int(choice)
        if choice not in range(len(course_list)):
            print('输入课程编号有误!')
            continue
        course_name = course_list[choice]

        flag, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info['user'])
        if flag:
            print(student_list)
            break
        else:
            print(student_list)
            break
Example #5
0
def change_score_syudent():
    """
     1 先获取老师下的所有的课程,并选择
     2 获取选择老师科恒的学生
     3 调用接口修改学生成绩
    """
    while True:
        # 查看教授的课程
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info.get("user"))
        if flag:
            print(course_list)
        else:
            print(course_list)
        for index, course_name in enumerate(course_list):
            print("编号%s,课程%s" % (index, course_name))
        choices = input("请输入编号").strip()
        if not choices.isdigit():
            print("请输入数字")
            continue
        choices = int(choices)
        if choices not in range(len(course_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        course_name = course_list[choices]
        print(course_name)
        print(teacher_info.get("user"))
        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info.get("user"))
        if not flag2:
            print(student_list)
            break
        for index2, student_name in enumerate(student_list):
            print("编号%s, 学生名%s" % (index2, student_name))
        choices2 = input("请输入编号").strip()
        if not choices2.isdigit():
            print("请输入数字")
            continue
        choices2 = int(choices2)
        if choices2 not in range(len(student_list)):
            print("请输入正确的编号")
            continue
        # 选择课程的名字
        student_name = student_list[choices]
        #修改学生成绩
        score = input("请输入修改的成绩分数:").strip()
        if not score.isdigit():
            print("输入有误")
            continue
        score = int(score)
        #调用修改学生接口
        flag3, mag = teacher_interface.change_score_interface(
            student_name, score, course_name, teacher_info.get("user"))
        if flag3:
            print(mag)
            break
Example #6
0
def change_score_from_student():
    #1.列出老师所有教授课程供老师选择
    while True:
        flag, course_list_or_msg = teacher_interface.check_course_interface(
            teacher_info.get('user'))
        if not flag:
            print(course_list_or_msg)
            break
        for index, course_name in enumerate(course_list_or_msg):
            print(f'编号:{index} 课程名称:{course_name}')

        choice = input('请输入你的选择:').strip()
        if not choice.isdigit():
            print('输入有误')
            continue
        choice = int(choice)
        if choice not in range(len(course_list_or_msg)):
            print('输入有误')
            continue
        course_name = course_list_or_msg[choice]

        #2.列出所选择课程下所有学生供老师选择
        flag2, student_list_or_msg = teacher_interface.get_student_interface(
            course_name, teacher_info.get('user'))
        if not flag2:
            print(student_list_or_msg)
            break
        for index2, student_name in enumerate(student_list_or_msg):
            print(f'编号:{index2} 学生姓名:{student_name}')

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

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

        #3.调用所选择的学生的分数修改接口
        score = input('请输入你的分数:').strip()
        if not score.isdigit():
            print('输入有误')
            continue
        score = int(score)

        flag3, msg = teacher_interface.change_score_interface(
            course_name, student_name, score, teacher_info.get('user'))

        if flag3:
            print(msg)
        else:
            print(msg)
Example #7
0
def change_score_from_student():
    """
    # 1.先获取老师下所有的课程并选择
    # 2.获取课程下所有的学生,并选择修改的学生
    # 3.调用修改学生分数接口
    """
    while True:
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info['user'])
        if not flag:
            print(course_list)
            break
        for index, course_name in enumerate(course_list):
            print(f'课程编号为:[{index}], 课程名称为:[{course_name}]')
        choice = input('请输入选择的课程编号==>').strip()
        if not choice.isdigit():
            print('输入有误!')
            continue
        choice = int(choice)
        if choice not in range(len(course_list)):
            print('输入课程编号有误!')
            continue
        course_name = course_list[choice]

        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info['user'])
        if not flag2:
            print(student_list)
            break
        for index, stu_name in enumerate(student_list):
            print(f'学生编号为:[{index}], 学校姓名为:[{stu_name}]')
        choice_stu = input('请输入学生编号==>').strip()
        if not choice_stu.isdigit():
            print('输入有误!')
            continue
        choice_stu = int(choice_stu)
        if choice_stu not in range(len(student_list)):
            print('输入学生编号有误!')
            continue
        stu_name = student_list[choice_stu]

        score = input('请输入修改的成绩==>').strip()
        if not score.isdigit():
            print('输入成绩有误!')
            continue
        score = int(score)
        flag3, msg = teacher_interface.change_score_interface(
            course_name, stu_name, score, teacher_info['user'])
        if flag3:
            print(msg)
            break

    pass
Example #8
0
def change_score_from_stu():
    '''
     1.先获取老师下所有的课程,并选择
     2.获取选择的课程下所有的学生,并选择修改的学生
     3.调用修改学生分数接口修改分数
    '''
    while True:
        # 1.先获取当前老师下所有的课程
        flag, course_list = teacher_interface.check_course_interface(teacher_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2.打印所有课程,并让老师选择
        for index, course_name in enumerate(course_list):
            print(f'编号:{index}    课程名:{course_name}')

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

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

        choice = int(choice)

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

        # 3.获取选择的课程名称
        course_name = course_list[choice]

        # 4.利用当前课程名称获取所有学生
        flag2, student_list = teacher_interface.get_student_interface(course_name, teacher_info.get('user'))

        if not flag2:
            print(student_list)
            break

        # 5.打印所有学生让老师选择
        for index, student_name in enumerate(student_list):
            print(f'编号:{index}   学生名:{student_name}')

        choice2 = input('请输入学生编号:').strip()

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

        choice2 = int(choice2)

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

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

        # 7.老师输入需要修改的分数
        score = input('请输入需要修改的成绩:').strip()
        if not score.isdigit():
            print('输入错误')
            continue

        score = int(score)

        flag3, msg = teacher_interface.change_score_interface(course_name, student_name, score,
                                                              teacher_info.get('user'))

        if flag3:
            print(msg)
            break
Example #9
0
def change_score_from_student():
    '''
    # 1、先获取老师下所有的课程,并选择
    # 2、获取选择的课程下所有的学生,并选择修改的学生
    # 3、调用修改学生分数接口修改分数
    '''
    while True:
        # 1、调用获取当前老师下所有的课程接口
        flag, course_list = teacher_interface.check_course_interface(
            teacher_info.get('user'))
        if not flag:
            print(course_list)
            break

        # 2、打印所有课程,并让老师选择
        for index, course_name in enumerate(course_list):
            print(f'编号: {index}   课程名: {course_name}')

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

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

        choice = int(choice)

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

        # 3、获取选择的课程名称
        course_name = course_list[choice]

        # 4、利用当前课程名称获取所有学生
        flag2, student_list = teacher_interface.get_student_interface(
            course_name, teacher_info.get('user'))

        if not flag2:
            print(student_list)
            break

        # 5、打印所有学生让老师选择
        for index2, student_name in enumerate(student_list):
            print(f'编号:{index2}   学生名: {student_name}')

        choice2 = input('请输入学生编号: ').strip()

        choice2 = int(choice2)

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

        # 获取选择的课程名称
        student_name = student_list[choice2]

        # 老师输入需要修改的分数
        score = input('请输入需要修改的成绩:').strip()
        if not score.isdigit():
            continue

        score = int(score)

        # 6、调用修改学生分数接口修改分数
        flag3, msg = teacher_interface.change_score_interface(
            course_name, student_name, score, teacher_info.get('user'))

        if flag3:
            print(msg)
            break