tasking-manager icon indicating copy to clipboard operation
tasking-manager copied to clipboard

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

Open JoltCode opened this issue 2 years ago • 15 comments

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 avatar Oct 11 '23 09:10 JoltCode

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

JoltCode avatar Oct 11 '23 09:10 JoltCode

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

JoltCode avatar Oct 11 '23 10:10 JoltCode

@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?

ramyaragupathy avatar Oct 11 '23 10:10 ramyaragupathy

@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?

JoltCode avatar Oct 11 '23 10:10 JoltCode

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.

petya-kangalova avatar Oct 11 '23 12:10 petya-kangalova

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 👍

JoltCode avatar Oct 11 '23 13:10 JoltCode

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

Patrik-Br avatar Oct 11 '23 18:10 Patrik-Br

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 😅

JoltCode avatar Oct 12 '23 10:10 JoltCode

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??

manjitapandey avatar Oct 13 '23 08:10 manjitapandey

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

JoltCode avatar Oct 13 '23 11:10 JoltCode

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

manjitapandey avatar Oct 16 '23 04:10 manjitapandey

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

Patrik-Br avatar Oct 16 '23 05:10 Patrik-Br

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

Patrik-Br avatar Oct 16 '23 05:10 Patrik-Br

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.

manjitapandey avatar Nov 20 '23 10:11 manjitapandey

@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"

RAytoun avatar Feb 14 '24 14:02 RAytoun