diff --git a/SW/PC/Stopwatch/registrace.py b/SW/PC/Stopwatch/registrace.py index d7dbe21..caf0d52 100644 --- a/SW/PC/Stopwatch/registrace.py +++ b/SW/PC/Stopwatch/registrace.py @@ -32,10 +32,7 @@ session.mount('https://', HTTPAdapter(max_retries=retries)) last_card = 0 last_time = datetime.datetime.now() -response = session.get(config['host'] + '/api/racers') - -racers = response.json() - +racers = [] log = [] @@ -106,8 +103,20 @@ def register_racer(): updateRacers() +def reload_racers(): + global racers + response = session.get(config['host'] + '/api/racers') + + racers = response.json() + updateRacers() + + +reload_racers() + + window = uic.loadUi("registrace.ui") window.register_racer.clicked.connect(register_racer) +window.reload_racers.clicked.connect(reload_racers) window.show() @@ -158,7 +167,7 @@ def updateLastCard(card_id): 'url': config['host'] + '/api/station/register', 'json': {'card_id': card_id, 'time': time.strftime('%d.%m.%Y %H:%M:%S.%f'), 'station_id': 1}, 'message': f"Úspěšné odstartování závodníka {racer['starting_number']}!", - 'failed': f"Núspěšné odstartování závodníka {racer['starting_number']}!", + 'failed': f"Núspěšné odstartování závodníka {racer['starting_number']}, prosím registraci opakujte!", }) racer['started'] = True diff --git a/SW/PC/Stopwatch/registrace.ui b/SW/PC/Stopwatch/registrace.ui index f85230e..9780c0c 100644 --- a/SW/PC/Stopwatch/registrace.ui +++ b/SW/PC/Stopwatch/registrace.ui @@ -14,6 +14,19 @@ Registrace závodníků + + + + Qt::Orientation::Vertical + + + + 20 + 40 + + + + @@ -31,22 +44,16 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - + + + + + Obnovit Závodníky + + +