Update get_leaderboard

Arlo Filley 2024-03-25 10:20:35 +00:00
parent b5a125964f
commit af7bc39612

@ -4,12 +4,27 @@
Returns the highest test data from each user as a JSON array. The data includes metrics such as username, words per minute (WPM), accuracy percentage, the time taken for the test, and the length of the test for a comprehensive overview of user performance. Returns the highest test data from each user as a JSON array. The data includes metrics such as username, words per minute (WPM), accuracy percentage, the time taken for the test, and the length of the test for a comprehensive overview of user performance.
## Request Parameters
- `username`: The name of the user.
- `wpm`: Words per minute, indicating the typing speed.
- `accuracy`: The accuracy of the user's typing, in percentage.
- `test_time`: The total time taken to complete the test, in seconds.
- `test_length`: The length of the test, typically measured in number of words.
## Responses ## Responses
- `200 OK`: Successfully retrieves the leaderboard data. - `200 OK`: Successfully retrieves the leaderboard data.
- `404 Not Found`: Indicates that the leaderboard was not found. - `404 Not Found`: Indicates that the leaderboard was not found.
- `500 Internal Server Error`: Indicates an issue with accessing the database. - `500 Internal Server Error`: Indicates an issue with accessing the database.
## Example Request
```bash
curl -X GET "https://url/api/leaderboard"
```
## Example Response ## Example Response
```json ```json
@ -30,11 +45,3 @@ Returns the highest test data from each user as a JSON array. The data includes
} }
] ]
``` ```
## Fields
- `username`: The name of the user.
- `wpm`: Words per minute, indicating the typing speed.
- `accuracy`: The accuracy of the user's typing, in percentage.
- `test_time`: The total time taken to complete the test, in seconds.
- `test_length`: The length of the test, typically measured in number of words.