Skip to content

Commit 07bf1b0

Browse files
committed
Refactor data file paths and reorganize data folders
Updated file paths in f1api.py and pronos.py to reflect new folder structure for pronos, result, and session data. Renamed and moved JSON data files into corresponding subdirectories for better organization and maintainability.
1 parent 3a98133 commit 07bf1b0

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

app/f1api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def getResults():
7979

8080
country = country_fonction()
8181
session_name = get_session_name()
82-
with open(f'data/Session_{country}_{session_name}.json', 'r', encoding='utf-8') as f:
82+
with open(f'data/session/Session_{country}_{session_name}.json', 'r', encoding='utf-8') as f:
8383
data = json.load(f)
8484

8585
country = data.get('Country', 'unknown').lower()
@@ -127,11 +127,11 @@ def getResults():
127127
return 1
128128

129129
if session_type == "Q":
130-
filename = f'data/Results_Qualif_{country}.json'
130+
filename = f'data/result/Results_Qualif_{country}.json'
131131
elif session_type == "S":
132-
filename = f'data/Results_Sprint_{country}.json'
132+
filename = f'data/result/Results_Sprint_{country}.json'
133133
else:
134-
filename = f'data/Results_Course_{country}.json'
134+
filename = f'data/result/Results_Course_{country}.json'
135135

136136
try:
137137
with open(filename, 'w', encoding='utf-8') as f:

app/pronos.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ def pronos_generic(pseudo, premier, second, troisieme, statue, best_lap=None):
5050
country = country_fonction()
5151

5252
if statue == "qualif":
53-
file_path = f'data/pronos_{country}_qualifs.json'
53+
file_path = f'data/pronos/pronos_{country}_qualifs.json'
5454
elif statue == "sprint":
55-
file_path = f'data/pronos_{country}_sprint.json'
55+
file_path = f'data/pronos/pronos_{country}_sprint.json'
5656
elif statue == "sprint_qualif":
57-
file_path = f'data/pronos_{country}_qualifsprint.json'
57+
file_path = f'data/pronos/pronos_{country}_qualifsprint.json'
5858
else:
59-
file_path = f'data/pronos_{country}.json'
59+
file_path = f'data/pronos/pronos_{country}.json'
6060

6161
if not os.path.exists(file_path):
6262
pronos_database = {}
@@ -102,8 +102,8 @@ async def visualisation(interaction: discord.Interaction):
102102

103103
try:
104104
country = country_fonction()
105-
file_path_course = f'data/pronos_{country}.json'
106-
file_path_qualif = f'data/pronos_{country}_qualifs.json'
105+
file_path_course = f'data/pronos/pronos_{country}.json'
106+
file_path_qualif = f'data/pronos/pronos_{country}_qualifs.json'
107107

108108
tool.ensure_file_exists(file_path_course)
109109
tool.ensure_file_exists(file_path_qualif)

0 commit comments

Comments
 (0)