src/server/server.py
def on_add_race_format():
    '''Adds new format in the database by duplicating an existing one.'''
    source_format = getCurrentRaceFormat()
    all_format_names = [format.name for format in Database.RaceFormat.query.all()]
    new_format = Database.RaceFormat(name=uniqueName(source_format.name, all_format_names),
                             race_mode=source_format.race_mode,
                             race_time_sec=source_format.race_time_sec ,
                             start_delay_min=source_format.start_delay_min,
                             start_delay_max=source_format.start_delay_max,
                             staging_tones=source_format.staging_tones,
                             number_laps_win=source_format.number_laps_win,
                             win_condition=source_format.win_condition,
                             team_racing_mode=source_format.team_racing_mode)
    DB.session.add(new_format)
    DB.session.flush()
    DB.session.refresh(new_format)
    DB.session.commit()

    Events.trigger(Evt.RACE_FORMAT_ADD, {
        'race_format': new_format.id,
        })

    on_set_race_format(data={ 'race_format': new_format.id })
Adds new format in the database by duplicating an existing one.
Adds new format in the database by duplicating an existing one.
Adds new format in the database by duplicating an existing one .
def on_add_race_format():
    source_format = getCurrentRaceFormat()
    all_format_names = [format.name for format in Database.RaceFormat.query.all()]
    new_format = Database.RaceFormat(name=uniqueName(source_format.name, all_format_names),
                             race_mode=source_format.race_mode,
                             race_time_sec=source_format.race_time_sec ,
                             start_delay_min=source_format.start_delay_min,
                             start_delay_max=source_format.start_delay_max,
                             staging_tones=source_format.staging_tones,
                             number_laps_win=source_format.number_laps_win,
                             win_condition=source_format.win_condition,
                             team_racing_mode=source_format.team_racing_mode)
    DB.session.add(new_format)
    DB.session.flush()
    DB.session.refresh(new_format)
    DB.session.commit()
    Events.trigger(Evt.RACE_FORMAT_ADD, {
        'race_format': new_format.id,
        })
    on_set_race_format(data={ 'race_format': new_format.id })
def on_add_race_format ( ) : source_format = getCurrentRaceFormat ( ) all_format_names = [ format . name for format in Database . RaceFormat . query . all ( ) ] new_format = Database . RaceFormat ( name = uniqueName ( source_format . name , all_format_names ) , race_mode = source_format . race_mode , race_time_sec = source_format . race_time_sec , start_delay_min = source_format . start_delay_min , start_delay_max = source_format . start_delay_max , staging_tones = source_format . staging_tones , number_laps_win = source_format . number_laps_win , win_condition = source_format . win_condition , team_racing_mode = source_format . team_racing_mode ) DB . session . add ( new_format ) DB . session . flush ( ) DB . session . refresh ( new_format ) DB . session . commit ( ) Events . trigger ( Evt . RACE_FORMAT_ADD , { 'race_format' : new_format . id , } ) on_set_race_format ( data = { 'race_format' : new_format . id } )
Adds new format in the database by duplicating an existing one.
Adds new format in the database by duplicating an existing one .
'''Adds new format in the database by duplicating an existing one.'''