karrot-dev / karrot-frontend

We migrated to https://codeberg.org/karrot/karrot-frontend
https://codeberg.org/karrot/karrot-frontend
428 stars 177 forks source link

Places that don't want to cooperate anymore are missing on statistics page #2671

Closed dwaxweiler closed 10 months ago

dwaxweiler commented 1 year ago

The statistics page currently only shows the data of the places that are cooperating. It should also include the places that are not cooperating anymore so that their weight data are included in the total amount.

nicksellen commented 1 year ago

Yes, makes sense! At the moment it shows all places even if all the values are 0, so I wonder it should do if including the non-co-operating places?

  1. show all places with any number != 0, regardless of status
  2. show all co-operating places (even if all numbers are 0), and also show non-co-operating places if any number > 0

1 makes more sense to me, as it's simpler... any thoughts?

dwaxweiler commented 1 year ago

Both options work for our group, but I wonder whether archived places should be shown too. For instance, in our group, we only archive places if they have been created by mistake, for testing or as a duplicate. I don't know how other groups use them, so I have a slight preference for excluding at least archived places.

nicksellen commented 1 year ago

Hmm, I looked and there is no filter for the status of the place.

The code that creates the query is:

https://github.com/karrot-dev/karrot-backend/blob/9b3c3710792323223023a47459b2b0b95cf426f9/karrot/stats/api.py#L57-L106

On my local machine I also added a test where I archive one of the places, and it still returned statistics for that place.

So, I see three possibilities:

  1. if the place is marked inactive before the past activities are processed, then the history won't get created for those, and they would not show up in the query
    • ... but I think the time window for that is tiny... the processing runs every minute, and normally the processing takes about 0.1s and the max in the server logs is ~10s ...
    • there is a slightly oddity in that past activities are processed after the start time is passed (not the end time), but seems unlikely to be the cause
  2. your original report was mistaken or a confusion, maybe if you share some more detail I can investigate more?
  3. something else has happened that I can't imagine at this moment ...

Could you share some more detail from your original report, and I can investigate further from there :)

dwaxweiler commented 1 year ago

You here right! Sorry, that's my fault; I have not checked this comprehensively enough. Indeed, I can see that the non-cooperating and archived places are present on our stats page as well. The only thing that made it look suspicious to me was that I checked the total sum at the beginning of August and compared it to the last value from some months ago, the sum was about 100 tonnes smaller. Maybe, this was also a human copy-paste mistake back then. If you don't see something more, I suggest to close this for now.