Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API call /api/v2/challenge/{id} sometimes returns slightly wrong values for keys .completionPercentage and .tasksRemaining #1148

Open
ricloy opened this issue Sep 14, 2024 · 0 comments

Comments

@ricloy
Copy link

ricloy commented Sep 14, 2024

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:

  1. 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

  1. 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

  1. 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

  1. 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

  1. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant