Skip to content

Improve nightly calculation of store statistics

Alex requested to merge improve-store-statistics into master

Part of #622 (closed) and #9 (closed)

What does this MR do?

Uses more general SQL queries for the calculation of store pickup statistics in the nightly run. Up to now, it is calculated with one query for each store to fetch the store team followed by 4 queries for each member of the store. Three of those are now done once for each store instead of once for each member of the store.

I left the query for saving the results in the inner loop, i.e. for each member, because there's already enough that could go wrong here. That could still be improved in the future by having one larger query for saving the whole store team.

How confident are you it won't break things if deployed?

Not very much. I'd be happy about some feedback about the SQL queries.

I tested the queries in phpMyAdmin and had the stats script

./scripts/docker-compose run --rm --no-deps app php -f run.php Stats betriebe

run successfully. However, there is not enough seed data to be sure.

How to test

I don't know

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • set a "for:" label to indicate who will be affected by this change
  • use "state:" labels to track this MR's state until it was beta tested
  • added an entry to CHANGELOG.md
  • add a short text that can be used in the release notes
  • Once your MR has been merged, you are responsible to create a testing issue in Beta Testing Repo:
    • Consider writing a detailed description in German.
    • Describe in a few sentences, what should be tested from a user perspective.
    • Also mention different settings (e.g. different browsers, roles, ...). how this change can be tested.
    • Be aware, that also non technical people should understand.

Release notes text

(A short text that will appear in the release notes and describes the change for non-technical people. Not always necessary, e.g. not for refactoring.)

Edited by Alex

Merge request reports