Exemple #1
0
def set_coach_class_num(request):
    data = request.POST
    coachName = data.get('coachName')
    coachRank = data.get('coachRank')
    if not coachName or not coachRank:
        return ext_fail()
    CoachService.set_coach_class_num(coachName, int(coachRank))
    return ext_success()
Exemple #2
0
def set_coach_retraining(request):
    coach_name = request.POST['coachName']
    remark = request.POST['remark']
    class_ids = CoachService.get_coach_class_ids(coach_name)
    if class_ids:
        return ext_fail(class_ids)
    result = CoachService.set_coach_retraining(coach_name,
                                               request.user.username, remark)
    if result:
        return ext_success()
    return ext_fail()
Exemple #3
0
def coach_hiring_import(request):
    coach_names_text = request.POST['coachNames']
    coach_names = coach_names_text.replace('\r', '').split('\n')
    check_result = CoachService.check_import_hiring_coach_names(coach_names)
    if check_result.imported or check_result.notExists \
            or check_result.notTeacher:
        return ext_fail(check_result)
    result = CoachService.import_hiring_coaches(coach_names)
    if result:
        return ext_success()
    return ext_fail()
Exemple #4
0
def dismiss_coach(request):
    coach_name = request.POST['coachName']
    remark = request.POST['remark']
    class_ids = CoachService.get_coach_class_ids(coach_name)
    if class_ids:
        return ext_fail(class_ids)
    result = CoachService.dismiss_coach(coach_name, request.user.username,
                                        remark)
    if result:
        return ext_success()
    else:
        return ext_fail()
Exemple #5
0
def set_coach_positive(request):
    coach_name = request.POST['coachName']
    remark = "转正"
    result = CoachService.set_coach_positive(coach_name, request.user.username,
                                             remark)
    if result:
        return ext_success()
    return ext_fail()
Exemple #6
0
def set_coach_trial(request):
    coach_name = request.POST['coachName']
    remark = request.POST['remark']
    result = CoachService.set_coach_trial(coach_name, request.user.username,
                                          remark)
    if result:
        return ext_success()
    return ext_fail()
Exemple #7
0
def cancel_coach_retraining(request):
    coach_name = request.POST['coachName']
    remark = "再培结束"
    result = CoachService.cancel_coach_retraining(coach_name,
                                                  request.user.username,
                                                  remark)
    if result:
        return ext_success()
    else:
        return ext_fail()
Exemple #8
0
def coach_hiring_list(request):
    offset = int(request.GET['start'])
    limit = int(request.GET['limit'])
    args = request.GET
    parameters = {}
    if args.get('userName'):
        parameters['userName'] = request.GET['userName']
    if args.get('phone'):
        parameters['phone'] = request.GET['phone']
    if args.get('subjectId'):
        parameters['subjectId'] = int(request.GET['subjectId'])
    if args.get('qq'):
        parameters['qq'] = request.GET['qq']
    data, total = CoachService.filter_hiring_coaches(limit, offset,
                                                     **parameters)
    return ext_success({'rows': data, 'total': total})
Exemple #9
0
def fire_coach_info_by_name(request):
    user_name = request.GET['userName']
    data, total = CoachService.fire_coach_info_by_name(user_name)
    return ext_success({'rows': data, 'total': ''})
Exemple #10
0
def coach_usable_period_by_id(request):
    userName = request.GET['userName']
    data = CoachService.get_coach_period_list(userName)

    return ext_success({'rows': data, 'total': ''})