Wrong sum up of pickup

Hi,

We find out that when two or more peoples are sign in to pickup, then after they give Feedback. In total saved weight of food it looks like avarage amout is calculated. We found two cases one was that one of users put 10kg, second one 5kg, total pick up was 8kg.
Second case in screen one pick up two users put 20kg each, total is 20kg

1 Like

A while back we changed the logic when multiple people add feedback for one activity, but maybe we forgot to change is for the total there? I’ll have a look into it.

1 Like

Ah, seems we didn’t change the place statistics when we switched to sum-mode a while back… (although all other uses of the weight should be fine). I created a PR to fix it Fix place statistics, weight avg -> sum by nicksellen · Pull Request #1137 · yunity/karrot-backend · GitHub - would be worth @tiltec checking I’m not getting confused or something!

1 Like

Ah confusing! This is literally the only place where we ever do that calculation.

Your fix seems good! For some reason, I can’t approve it from mobile though…

I dug a bit into the changes and it seems the “Avg” got accidentially reintroduced here, despite the PR description: Add activity history statistics endpoint by nicksellen · Pull Request #1040 · yunity/karrot-backend · GitHub

1 Like

There is the activity stats (separate from the place stats) in the PR you linked, so two places where it needs to do sum.

Indeed, the annotate_feedback_weight ended up with Avg not Sum, and as I was introducing a new endpoint, kind of ignored that one, and the tests still passed (checking Avg), so it was hidden away until now!

2 Likes