src/server/server.py
def duplicate_heat(source, **kwargs):
    '''Adds new heat by duplicating an existing one.'''
    source_heat = Database.Heat.query.get(source)

    if source_heat.note:
        all_heat_notes = [heat.note for heat in Database.Heat.query.all()]
        new_heat_note = uniqueName(source_heat.note, all_heat_notes)
    else:
        new_heat_note = ''

    if 'dest_class' in kwargs:
        new_class = kwargs['dest_class']
    else:
        new_class = source_heat.class_id

    new_heat = Database.Heat(note=new_heat_note,
        class_id=new_class,
        results=None,
        cacheStatus=Results.CacheStatus.INVALID)

    DB.session.add(new_heat)
    DB.session.flush()
    DB.session.refresh(new_heat)

    for source_heatnode in Database.HeatNode.query.filter_by(heat_id=source_heat.id).all():
        new_heatnode = Database.HeatNode(heat_id=new_heat.id,
            node_index=source_heatnode.node_index,
            pilot_id=source_heatnode.pilot_id)
        DB.session.add(new_heatnode)

    return new_heat.id
Adds new heat by duplicating an existing one.
Adds new heat by duplicating an existing one.
Adds new heat by duplicating an existing one .
def duplicate_heat(source, **kwargs):
    source_heat = Database.Heat.query.get(source)
    if source_heat.note:
        all_heat_notes = [heat.note for heat in Database.Heat.query.all()]
        new_heat_note = uniqueName(source_heat.note, all_heat_notes)
    else:
        new_heat_note = ''
    if 'dest_class' in kwargs:
        new_class = kwargs['dest_class']
    else:
        new_class = source_heat.class_id
    new_heat = Database.Heat(note=new_heat_note,
        class_id=new_class,
        results=None,
        cacheStatus=Results.CacheStatus.INVALID)
    DB.session.add(new_heat)
    DB.session.flush()
    DB.session.refresh(new_heat)
    for source_heatnode in Database.HeatNode.query.filter_by(heat_id=source_heat.id).all():
        new_heatnode = Database.HeatNode(heat_id=new_heat.id,
            node_index=source_heatnode.node_index,
            pilot_id=source_heatnode.pilot_id)
        DB.session.add(new_heatnode)
    return new_heat.id
def duplicate_heat ( source , ** kwargs ) : source_heat = Database . Heat . query . get ( source ) if source_heat . note : all_heat_notes = [ heat . note for heat in Database . Heat . query . all ( ) ] new_heat_note = uniqueName ( source_heat . note , all_heat_notes ) else : new_heat_note = '' if 'dest_class' in kwargs : new_class = kwargs [ 'dest_class' ] else : new_class = source_heat . class_id new_heat = Database . Heat ( note = new_heat_note , class_id = new_class , results = None , cacheStatus = Results . CacheStatus . INVALID ) DB . session . add ( new_heat ) DB . session . flush ( ) DB . session . refresh ( new_heat ) for source_heatnode in Database . HeatNode . query . filter_by ( heat_id = source_heat . id ) . all ( ) : new_heatnode = Database . HeatNode ( heat_id = new_heat . id , node_index = source_heatnode . node_index , pilot_id = source_heatnode . pilot_id ) DB . session . add ( new_heatnode ) return new_heat . id
Adds new heat by duplicating an existing one.
Adds new heat by duplicating an existing one .
'''Adds new heat by duplicating an existing one.'''
source