Ejemplo n.º 1
0
def add_schedule():

    teams = TeamService.get_all()

    if request.method == 'GET':
        return render_template('admin/event/add_schedule.html', teams=teams)

    event_id = int(request.args.get('event_id'))

    schedule_dict = request.form.to_dict()
    schedule_dict['event_id'] = event_id
    MatchService.add(schedule_dict)

    return redirect(url_for('admin.list_match_schedules', event_id=event_id))
Ejemplo n.º 2
0
def add_schedule():

    event_id = int(request.args.get('event_id'))
    teams = EventTeamService.get_all_by_event(event_id)

    if request.method == 'GET':
        return render_template('admin/event/add_schedule.html', 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.add(schedule_dict)

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