added code for timer pushbutton
This commit is contained in:
37
SW/PC/Alkator_count_results.py
Normal file
37
SW/PC/Alkator_count_results.py
Normal 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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user