hotosm / tasking-manager

Tasking Manager - The tool to team up for mapping in OpenStreetMap
https://wiki.openstreetmap.org/wiki/Tasking_Manager
BSD 2-Clause "Simplified" License
496 stars 267 forks source link

[BUG] "You Mapped" Stats not adding totals correctly. #6077

Open JoltCode opened 8 months ago

JoltCode commented 8 months ago

Describe the bug On the stats page for the user, you can see that the total tasks does not add up correctly:

Screenshot 2023-10-11 at 10 45 08

We can see here that 82 + 25 does not add up to 91.

We can see that the addition is handled differently between the "You Mapped" section, and the "You Validated" section. https://github.com/hotosm/tasking-manager/blob/547e0ce706d40d680c774803828ae8c6a5cebf62/frontend/src/components/userDetail/elementsMapped.js#L33 https://github.com/hotosm/tasking-manager/blob/547e0ce706d40d680c774803828ae8c6a5cebf62/frontend/src/components/userDetail/elementsMapped.js#L51

To Reproduce

  1. Go to "My Contributions"
  2. If you have mapped a fair amount, you'll be able to view the issue - the numbers do not add up for "validated" + "needed more mapping"

Expected behavior The numbers should add up correctly, or, it should be clear why the "validated stats" addition is different to the "you mapped stats" addition.

Screenshots N/A Desktop (please complete the following information): N/A - No reason why it should or may be different across different devices.

Additional context N/A - May be related to our migration to ohsome stats and that the old stats being broken? Not sure. This may also be a backend issue, rather than a stats backend issue.

JoltCode commented 8 months ago

Massive thanks to Ralph from the Tasking Manager Meetup for catching this 🐛!

JoltCode commented 8 months ago

I believe this might be where the bug is: https://github.com/hotosm/tasking-manager/blob/547e0ce706d40d680c774803828ae8c6a5cebf62/backend/services/stats_service.py#L43-L116

Could also be the function that calls these, it might be calling it with bad data or something....?

ramyaragupathy commented 8 months ago

@JoltCode - thanks so much for quickly capturing the discussion from our working group meeting. Would you be interested in working on a fix for this?

JoltCode commented 8 months ago

@JoltCode - thanks so much for quickly capturing the discussion from our working group meeting. Would you be interested in working on a fix for this?

Yeah, although not sure if your team would be better at fixing this - the code for incrementing the stats is a little hard to understand... Perhaps we could discuss over Slack?

petya-kangalova commented 8 months ago

Thank you @JoltCode . @ramyaragupathy let us know who from the Naxa team might be able to look into Joe's initial investigation and then collaborate. Happy to then connect them on Slack if needed.

JoltCode commented 8 months ago

Thank you @JoltCode . @ramyaragupathy let us know who from the Naxa team might be able to look into Joe's initial investigation and then collaborate. Happy to then connect them on Slack if needed.

Sounds great! Thanks 👍

Patrik-Br commented 8 months ago

I always thought that those 91 tasks just wasn't validated yet :D

JoltCode commented 8 months ago

I always thought that those 91 tasks just wasn't validated yet :D

That's interesting if so - the assumption in the TM call was that there was some sort of bug, as the equivalent on the validation stats side (on the right) is an addition of the two other numbers.... Hmmm.... Either way, we should probably find out what this stat is haha 😅

manjitapandey commented 8 months ago

I thought this is about the number of tasks i mapped on total as a user and second showing the number of tasks i validated. Similarly, the third one is telling me about the number of tasks which were failed to validate. So i never thought that as an issue. Am i wrong on this case??

JoltCode commented 8 months ago

I thought this is about the number of tasks i mapped on total as a user and second showing the number of tasks i validated. Similarly, the third one is telling me about the number of tasks which were failed to validate. So i never thought that as an issue. Am i wrong on this case??

I don't think that's right, because the first number doesn't actually seem to be the total of any other two numbers on the page, but yeah the third number is the total of tasks which required more mapping (after a failed validation).

Screenshot 2023-10-13 at 12 47 49

As you can see, 85+25 does not add up to 104

manjitapandey commented 8 months ago

@JoltCode what i meant there was the first number means total number of mapping i have done as a mapper and second one means total number of tasks in which i performed the validation. This way it is not needed to be 85 + 25 = 104. Seeing that way there should be 104 mapped 85 validated 25 needs more mapping This could be confusion created by words.

Patrik-Br commented 8 months ago

@manjitapandey There is a separate section for tasks that the user validated image

Patrik-Br commented 8 months ago

Also when it goes for "needed more mapping" under "You mapped" those will be probably tasks that had been marked as "More mapping needed" before I locked them for mapping (I am fixing invalidated task mapped by someone else then me).

manjitapandey commented 7 months ago

Since we haven't incorporated tasks mapped but not validated. the number of total tasks mapped won't be equal to number of tasks validated + no of tasks needing more mapping. However issue still exists since number of tasks should be greater then adding later two.

RAytoun commented 4 months ago

@JoltCode @ramyaragupathy

If the first number is the total tasks mapped then that number should only be equal to or greater than the other two numbers. It will not always be that all the mapper's tasks will be validated or invalidated as some projects have been archived before the validation process has been completed.

The screenshot shows that this is not the case as the number of validated tasks is greater than the total number of tasks.

The only logic I could see for this is the first number is the number of tasks that have not been checked. The second number is the total number of tasks that have been validated. The third number is the tasks that have been invalidated. If this is correct then the total number of tasks would be all three added together and the first number could be more/equal to/or less than the sum of the others.

If this is the case then the numbers could be correct then the wording needs to show this.

This could then also explain the same inconsistencies in the numbers for "You validated"