@@ -147,6 +147,7 @@ def get_passage_data(passage:Passage, json=False)->dict:
147147 'name' :passage .inscription .inscrit .name ,
148148 'time_stamp' :passage .time_stamp if not json else passage .time_stamp .timestamp (),
149149 'parcours' :[]}
150+ ic (passage .inscription , passage , passage .id )
150151
151152 user_passages :list [Passage ] = Passage .query .filter (Passage .inscription == passage .inscription , Passage .time_stamp <= passage .time_stamp ).all ()
152153 if len (user_passages )> 0 :
@@ -179,6 +180,7 @@ def get_passage_data(passage:Passage, json=False)->dict:
179180 hours , remainder = divmod (delta .seconds , 3600 )
180181 minutes , seconds = divmod (remainder , 60 )
181182 delta = f"{ f'{ days } days, ' if days > 0 else '' } { hours :02} :{ minutes :02} :{ seconds :02} "
183+ ic (p , p .get_stand (), p .key .stands .all (), p .inscription .parcours )
182184 data ['parcours' ].append ({'stand' :p .get_stand () if not json else {'name' :p .get_stand ().name }, 'dist' :None , 'delta' :delta , 'success' :success })
183185 if not current :
184186 data ['parcours' ][- 1 ]['current' ]= True
@@ -243,14 +245,15 @@ def get_passages_data():
243245
244246@socketio .on ('set_passage' , namespace = '/key' )
245247def set_passage (data ):
246- inscription :Inscription = Inscription .query .filter (Inscription .dossard == data ['dossard' ]).first ()
247- if not inscription :
248- emit ('passage_response' , {"success" : False , 'saved' :False , 'error' :'not valide dossard' , 'request' :data }, to = session ['room' ])
249- return
250248 key = PassageKey .query .filter_by (key = session ['room' ]).first ()
251249 if not key :
252250 emit ('passage_response' , {"success" : False , 'saved' :False , 'error' :'not valide key' , 'request' :data }, to = session ['room' ])
253251 return
252+
253+ inscription :Inscription = Inscription .query .filter (Inscription .dossard == data ['dossard' ], Inscription .edition == key .edition ).first ()
254+ if not inscription :
255+ emit ('passage_response' , {"success" : False , 'saved' :False , 'error' :'not valide dossard' , 'request' :data }, to = session ['room' ])
256+ return
254257
255258 if inscription .end == 'finish' :
256259 emit ('passage_response' , {"success" : False , 'saved' :False , 'error' :'has already finish' , 'request' :data }, to = session ['room' ])
0 commit comments