maproulette / maproulette/maproulette-backend
API call /api/v2/challenge/{id} sometimes returns slightly wrong values for keys .completionPercentage and .tasksRemaining
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 53
- Forks
- 39
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 12
Description
In the JSON response for the API call /api/v2/challenge/{id} the keys .tasksRemaining and .completionPercentage sometimes show slightly wrong values. The correct values can be seen in the challenge web page (e.g. https://maproulette.org/browse/challenges/{id}) or by making a request at /api/v2/challenge/view/{id} and doing the math.
Here is a bunch of examples:
- Challenge 5556 (both values are wrong, 3% difference of completion):
$ curl -s 'https://maproulette.org/api/v2/challenge/5556' | jq -r .completionPercentage
76
$ curl -s 'https://maproulette.org/api/v2/challenge/5556' | jq -r .tasksRemaining
132
Web page https://maproulette.org/browse/challenges/5556 shows 79% and 118
- Challenge 43716 (both values are wrong, 1% difference of completion):
$ curl -s 'https://maproulette.org/api/v2/challenge/43716' | jq -r .completionPercentage
38
$ curl -s 'https://maproulette.org/api/v2/challenge/43716' | jq -r .tasksRemaining
286
Web page https://maproulette.org/browse/challenges/43716 shows 39% and 282
- Challenge 28186 (only .completionPercentage is wrong, 1% difference of completion):
$ curl -s 'https://maproulette.org/api/v2/challenge/28186' | jq -r .completionPercentage
19
$ curl -s 'https://maproulette.org/api/v2/challenge/28186' | jq -r .tasksRemaining
5598
Web page https://maproulette.org/browse/challenges/28186 shows 20% and 5598
- Challenge 42381 (only .completionPercentage is wrong, 1% difference of completion):
$ curl -s 'https://maproulette.org/api/v2/challenge/42381' | jq -r .completionPercentage
3
$ curl -s 'https://maproulette.org/api/v2/challenge/42381' | jq -r .tasksRemaining
26193
Web page https://maproulette.org/browse/challenges/42381 shows 4% and 26193
- Challenge 48926 (both values are wrong, 1% difference of completion):
$ curl -s 'https://maproulette.org/api/v2/challenge/48926' | jq -r .completionPercentage
48
$ curl -s 'https://maproulette.org/api/v2/challenge/48926' | jq -r .tasksRemaining
11552
Web page https://maproulette.org/browse/challenges/48926 shows 49% and 11510
I suppose that when .tasksRemaining contains the correct value it's just a problem of rounding to the nearest integer (because the .completionPercentage seems to be offset to just 1%), but what about the case where the difference is greater than 1%?
Kind regards,
Marco.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the /api/v2/challenge/{id} and /api/v2/challenge/view/{id} API endpoints, using the example challenge IDs and curl commands in the report. Compare both responses with the challenge web page and trace where tasksRemaining and completionPercentage are calculated. Done means the endpoint values match the documented examples and regression coverage verifies the calculations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100