Пример #1
0
def edit_schedule(schedule_id):
    event_id = request.args.get('event_id', 0)
    event_id = int(event_id)
    match = MatchService.get_one(schedule_id)
    teams = EventTeamService.get_all_by_event(event_id)
    default_tm = request.args.get('date')
    if request.method == 'GET':
        return render_template(
                                              'admin/event/edit_schedule.html',
                                              match=match, teams=teams)

    schedule_dict = {}

    schedule_dict['event_id'] = event_id
    schedule_dict['start_tm'] = request.form.get('start_tm')
    schedule_dict['status'] = request.form.get('status',type=int)
    schedule_dict['round'] = request.form.get('round',0,type=int)
    schedule_dict['brief'] = request.form.get('brief')
    schedule_dict['team1_id'] = request.form.get('team1_id')
    schedule_dict['team1_score'] = request.form.get('team1_score',0,type=int)
    schedule_dict['team2_id'] = request.form.get('team2_id')
    schedule_dict['team2_score'] = request.form.get('team2_score',0,type=int)

    MatchService.edit(schedule_id, schedule_dict)

    return redirect(url_for('admin.list_match_schedules', event_id=event_id,date=default_tm))
Пример #2
0
def add_forecast(match_id):

    event_id = request.args.get('event_id', 0)
    event_id = int(event_id)
    match = MatchService.get_one(match_id)
    default_tm = request.args.get('date')
    if request.method == 'GET':
        return render_template('admin/event/add_forecast.html', match=match)

    match_dict = request.form.to_dict()
    MatchService.edit(match_id, match_dict)

    return redirect(url_for('admin.list_hot_matches', event_id=event_id,date=default_tm))
Пример #3
0
def edit_schedule(schedule_id):
    event_id = request.args.get('event_id', 0)
    event_id = int(event_id)
    match = MatchService.get_one(schedule_id)
    teams = TeamService.get_all()
    default_tm = request.args.get('date')
    if request.method == 'GET':
        return render_template('admin/event/edit_schedule.html',
                               match=match,
                               teams=teams)

    schedule_dict = request.form.to_dict()
    MatchService.edit(schedule_id, schedule_dict)

    return redirect(
        url_for('admin.list_match_schedules',
                event_id=event_id,
                date=default_tm))