Alkator/SW/PC/Alkator_count_results.py
Martin Quarda 097d741ffc Revert "cleanup"
This reverts commit 0fab73b098a09eaee80bc5f80e05a234c574a497.
2025-04-28 10:41:20 +02:00

33 lines
672 B
Python

#!/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)