File tree Expand file tree Collapse file tree 4 files changed +29
-38
lines changed Expand file tree Collapse file tree 4 files changed +29
-38
lines changed Original file line number Diff line number Diff line change @@ -163,4 +163,7 @@ cython_debug/
163
163
* .ipynb
164
164
165
165
# Vscode
166
- .vscode /
166
+ .vscode /
167
+
168
+ # DS_Store
169
+ * .DS_Store
Original file line number Diff line number Diff line change @@ -28,23 +28,23 @@ document.addEventListener('DOMContentLoaded', () => {
28
28
difficulty : difficulty
29
29
} ;
30
30
31
- // console.log('data to be sent:');
32
- // console.log(JSON.stringify(postData));
33
-
34
- // fetch('http://127.0.0.1 :8000/add_score', {
35
- // method: 'POST',
36
- // headers: {
37
- // 'Content-Type': 'application/json'
38
- // },
39
- // body: JSON.stringify(postData)
40
- // })
41
- // .then(response => response.json())
42
- // .then(data => {
43
- // console.log('Success:', data);
44
- // })
45
- // .catch((error) => {
46
- // console.error('Error:', error);
47
- // });
31
+ console . log ( 'data to be sent:' ) ;
32
+ console . log ( JSON . stringify ( postData ) ) ;
33
+
34
+ fetch ( 'http://localhost :8000/add_score' , {
35
+ method : 'POST' ,
36
+ headers : {
37
+ 'Content-Type' : 'application/json'
38
+ } ,
39
+ body : JSON . stringify ( postData )
40
+ } )
41
+ . then ( response => response . json ( ) )
42
+ . then ( data => {
43
+ console . log ( 'Success:' , data ) ;
44
+ } )
45
+ . catch ( ( error ) => {
46
+ console . error ( 'Error:' , error ) ;
47
+ } ) ;
48
48
49
49
// Get the podium from the server
50
50
fetch ( 'http://localhost:8000/scores' )
Original file line number Diff line number Diff line change @@ -171,10 +171,9 @@ async def get_labels():
171
171
172
172
173
173
@app .get ("/scores" )
174
- async def get_scores (mode : str , difficulty : str ):
174
+ async def get_scores ():
175
175
"""
176
- Function to return the top 3 scores from the database
177
- filtered by the given mode and difficulty.
176
+ Function to return all scores from the database without any filters.
178
177
It returns a dictionary with the scores.
179
178
180
179
score1: { user: user1,
@@ -205,14 +204,9 @@ async def get_scores(mode: str, difficulty: str):
205
204
206
205
data = _data [1 ]
207
206
df = pd .DataFrame (data )
208
- df_filtered = df [(df ['mode' ] == mode ) & (df ['difficulty' ] == difficulty )]
209
207
210
- df_filtered = df_filtered .sort_values (by = ['score' , 'mean_time' ],
211
- ascending = [False , True ])
212
-
213
- df_top3 = df_filtered .head (3 )
214
-
215
- scores = df_top3 .to_dict (orient = 'records' )
208
+ # Return the DataFrame as a dictionary without any filtering
209
+ scores = df .to_dict (orient = 'records' )
216
210
217
211
return scores
218
212
Original file line number Diff line number Diff line change @@ -173,10 +173,9 @@ async def get_labels():
173
173
174
174
175
175
@app .get ("/scores" )
176
- async def get_scores (mode : str , difficulty : str ):
176
+ async def get_scores ():
177
177
"""
178
- Function to return the top 3 scores from the database
179
- filtered by the given mode and difficulty.
178
+ Function to return all scores from the database without any filters.
180
179
It returns a dictionary with the scores.
181
180
182
181
score1: { user: user1,
@@ -207,14 +206,9 @@ async def get_scores(mode: str, difficulty: str):
207
206
208
207
data = _data [1 ]
209
208
df = pd .DataFrame (data )
210
- df_filtered = df [(df ['mode' ] == mode ) & (df ['difficulty' ] == difficulty )]
211
209
212
- df_filtered = df_filtered .sort_values (by = ['score' , 'mean_time' ],
213
- ascending = [False , True ])
214
-
215
- df_top3 = df_filtered .head (3 )
216
-
217
- scores = df_top3 .to_dict (orient = 'records' )
210
+ # Return the DataFrame as a dictionary without any filtering
211
+ scores = df .to_dict (orient = 'records' )
218
212
219
213
return scores
220
214
You can’t perform that action at this time.
0 commit comments