Skip to content

Commit 4da36d7

Browse files
final version: todo last readme
1 parent 0417d66 commit 4da36d7

File tree

4 files changed

+29
-38
lines changed

4 files changed

+29
-38
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,7 @@ cython_debug/
163163
*.ipynb
164164

165165
# Vscode
166-
.vscode/
166+
.vscode/
167+
168+
# DS_Store
169+
*.DS_Store

app/js/end_game.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ document.addEventListener('DOMContentLoaded', () => {
2828
difficulty: difficulty
2929
};
3030

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+
});
4848

4949
// Get the podium from the server
5050
fetch('http://localhost:8000/scores')

endpoints/predict_gpu.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,9 @@ async def get_labels():
171171

172172

173173
@app.get("/scores")
174-
async def get_scores(mode: str, difficulty: str):
174+
async def get_scores():
175175
"""
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.
178177
It returns a dictionary with the scores.
179178
180179
score1: { user: user1,
@@ -205,14 +204,9 @@ async def get_scores(mode: str, difficulty: str):
205204

206205
data = _data[1]
207206
df = pd.DataFrame(data)
208-
df_filtered = df[(df['mode'] == mode) & (df['difficulty'] == difficulty)]
209207

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')
216210

217211
return scores
218212

endpoints/predict_mps.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,9 @@ async def get_labels():
173173

174174

175175
@app.get("/scores")
176-
async def get_scores(mode: str, difficulty: str):
176+
async def get_scores():
177177
"""
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.
180179
It returns a dictionary with the scores.
181180
182181
score1: { user: user1,
@@ -207,14 +206,9 @@ async def get_scores(mode: str, difficulty: str):
207206

208207
data = _data[1]
209208
df = pd.DataFrame(data)
210-
df_filtered = df[(df['mode'] == mode) & (df['difficulty'] == difficulty)]
211209

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')
218212

219213
return scores
220214

0 commit comments

Comments
 (0)