src/server/server.py
def on_set_current_heat(data):
    '''Update the current heat variable.'''
    new_heat_id = data['heat']
    RACE.current_heat = new_heat_id

    RACE.node_pilots = {
        '0': 0,
        '1': 0,
        '2': 0,
        '3': 0,
        '4': 0,
        '5': 0,
        '6': 0,
        '7': 0,
    }
    RACE.node_teams = {
        '0': None,
        '1': None,
        '2': None,
        '3': None,
        '4': None,
        '5': None,
        '6': None,
        '7': None,
    }
    for heatNode in Database.HeatNode.query.filter_by(heat_id=new_heat_id):
        RACE.node_pilots[heatNode.node_index] = heatNode.pilot_id

        if heatNode.pilot_id is not Database.PILOT_ID_NONE:
            RACE.node_teams[heatNode.node_index] = Database.Pilot.query.get(heatNode.pilot_id).team
        else:
            RACE.node_teams[heatNode.node_index] = None

    logger.info('Current heat set: Heat {0}'.format(new_heat_id))

    if int(Options.get('calibrationMode')):
        autoUpdateCalibration()

    Events.trigger(Evt.HEAT_SET, {
        'race': RACE,
        'heat_id': new_heat_id,
        })

    RACE.cacheStatus = Results.CacheStatus.INVALID  # refresh leaderboard
    emit_current_heat() # Race page, to update heat selection button
    emit_current_leaderboard() # Race page, to update callsigns in leaderboard
    race_format = getCurrentRaceFormat()
    if race_format.team_racing_mode:
        check_emit_team_racing_status()
Update the current heat variable.
Update the current heat variable.
Update the current heat variable .
def on_set_current_heat(data):
    new_heat_id = data['heat']
    RACE.current_heat = new_heat_id
    RACE.node_pilots = {
        '0': 0,
        '1': 0,
        '2': 0,
        '3': 0,
        '4': 0,
        '5': 0,
        '6': 0,
        '7': 0,
    }
    RACE.node_teams = {
        '0': None,
        '1': None,
        '2': None,
        '3': None,
        '4': None,
        '5': None,
        '6': None,
        '7': None,
    }
    for heatNode in Database.HeatNode.query.filter_by(heat_id=new_heat_id):
        RACE.node_pilots[heatNode.node_index] = heatNode.pilot_id
        if heatNode.pilot_id is not Database.PILOT_ID_NONE:
            RACE.node_teams[heatNode.node_index] = Database.Pilot.query.get(heatNode.pilot_id).team
        else:
            RACE.node_teams[heatNode.node_index] = None
    logger.info('Current heat set: Heat {0}'.format(new_heat_id))
    if int(Options.get('calibrationMode')):
        autoUpdateCalibration()
    Events.trigger(Evt.HEAT_SET, {
        'race': RACE,
        'heat_id': new_heat_id,
        })
    RACE.cacheStatus = Results.CacheStatus.INVALID  
    emit_current_heat() 
    emit_current_leaderboard() 
    race_format = getCurrentRaceFormat()
    if race_format.team_racing_mode:
        check_emit_team_racing_status()
def on_set_current_heat ( data ) : new_heat_id = data [ 'heat' ] RACE . current_heat = new_heat_id RACE . node_pilots = { '0' : 0 , '1' : 0 , '2' : 0 , '3' : 0 , '4' : 0 , '5' : 0 , '6' : 0 , '7' : 0 , } RACE . node_teams = { '0' : None , '1' : None , '2' : None , '3' : None , '4' : None , '5' : None , '6' : None , '7' : None , } for heatNode in Database . HeatNode . query . filter_by ( heat_id = new_heat_id ) : RACE . node_pilots [ heatNode . node_index ] = heatNode . pilot_id if heatNode . pilot_id is not Database . PILOT_ID_NONE : RACE . node_teams [ heatNode . node_index ] = Database . Pilot . query . get ( heatNode . pilot_id ) . team else : RACE . node_teams [ heatNode . node_index ] = None logger . info ( 'Current heat set: Heat {0}' . format ( new_heat_id ) ) if int ( Options . get ( 'calibrationMode' ) ) : autoUpdateCalibration ( ) Events . trigger ( Evt . HEAT_SET , { 'race' : RACE , 'heat_id' : new_heat_id , } ) RACE . cacheStatus = Results . CacheStatus . INVALID emit_current_heat ( ) emit_current_leaderboard ( ) race_format = getCurrentRaceFormat ( ) if race_format . team_racing_mode : check_emit_team_racing_status ( )
Update the current heat variable.
Update the current heat variable .
'''Update the current heat variable.''' # refresh leaderboard # Race page, to update heat selection button # Race page, to update callsigns in leaderboard
data