added code for timer pushbutton

This commit is contained in:
2024-02-27 21:07:09 +01:00
parent 51d19ac1f5
commit acb098e183
7 changed files with 290 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 21 17:19:11 2023
@author: angoosh
"""
import json
FILE = './Alkator.json'
data_dict = ''
results = {}
with open(FILE,'r') as f:
file_content = f.read()
data_dict = json.loads(file_content)
for id in data_dict:
laps = int(data_dict[id]['laps'])
time = 0
for i in range(0,laps):
time += float(data_dict[id]['lap_time'][str(i)])
time = (time - (600*laps)) / 60
print(data_dict[id]['name'],time)
data_dict[id]['total_time'] = time
results[data_dict[id]['name']] = time
print(results)
dict(sorted(results.items(), key=lambda item: item[0]))
print(results)