- 🇩🇪Germany Anybody Porta Westfalica
Agree, this would totally make sense and should be implemented. For smaller stores, this is surely a very helpful thing and unexpected having to generatethe reports manually!
I think this should live on the settings page and one should be able to select which of the reports to generate on cron.
For larger shops, the better option might be ✨ Provide CLI commands to generate reports Needs work
- 🇩🇪Germany Anybody Porta Westfalica
I think this is what you need in cron:
https://git.drupalcode.org/project/commerce_reports/-/blob/8.x-1.x/src/O...Default should be to refresh reports all 24 hours I think? Maybe make the reports to regenerate selectable like in the generate form:
https://git.drupalcode.org/project/commerce_reports/-/blob/8.x-1.x/src/F...So basically most of the functionality is similar to what the form does, but it needs a stored configuration and execution happens on cron in the set interval.
- First commit to issue fork.
- 🇩🇪Germany Anybody Porta Westfalica
Nice, could we have an installation test and add the
configure
property in the info.yml? - 🇩🇪Germany Anybody Porta Westfalica
Great work! RTBC and super important feature, wondering who's really using this manually :D
So would be great to have this merged soon. Failing tests are unrelated, this wonderful module should get some love.
- 🇳🇴Norway zaporylie
Could you elaborate on why having such a function would be beneficial?
I kinda understand why would that be available via UI or perhaps CLI (for maintenance purposes) but, IMHO reports should be persistent and basically never regenerated as they should reflect the snapshot of the order state at a certain moment in time.
- 🇩🇪Germany Anybody Porta Westfalica
@zaporylie thanks for your feedback. From a client perspective, I'd expect the reports I see to be up to date without having to trigger anything. It would surely make a lot of sense to show the creation date for each report, so that you know when the report was created, but I'd see that as a separate feature request.
All our clients are using this functionality and independent from each other asked us, why they have to generate the reports manually. I don't know any other Commerce software that requires the users to generate the reports / dashboards themselves. Maybe they allow to manually force a rebuild or refresh, if they need updates now. But in general they show the reports up to date.
Sorry if I didn't get your question right?
- 🇩🇪Germany Anybody Porta Westfalica
@zaporylie: Let me ask the other way around: For which of the existing reports would it make sense to have outdated reports?
(Not having them "live", but via cron makes sense to me for performance reasons of course) - 🇳🇴Norway zaporylie
For which of the existing reports would it make sense to have outdated reports?
All of them? :) I wouldn't call it an outdated thought as it is very much valid at the time of generation.
I guess it all depends on how we look at this feature (or sell this feature to our clients). If we think of each report type as a storage derivative for the order model (which is kinda how it's presented on this module's page ATM) and the generation of the report is only for the sake of keeping data in the more queryable format then it makes sense to regenerate every time order is saved/updated.
But if we look at it from a different angle and say that reports are snapshots of the order state in a particular moment in time (by design - order placement) then regeneration should never be required. In fact, just looking at some plugins, the regeneration will not work great if ex. promotion is deleted by the time of regeneration. or default tax rate changes/is deleted, etc.
- 🇩🇪Germany Anybody Porta Westfalica
Thanks @zaporylie
You wrote:then it makes sense to regenerate every time order is saved/updated.
Maybe that's the reason for our misunderstandings: The reports have NEVER been generated without clicking "Generate reports" manually. If they were up-to-date by every order creation / update / delete, this feature indeed wouldn't be needed.
Do we have a bug? Or am I now really getting you wrong?
- 🇳🇴Norway zaporylie
Well, you're referring to only part of my comment :) And if this is what should be needed then I still wouldn't call it a bug but a missing feature.
But there's also the other view on this module's usefulness (and highlighted risk) that I tried to point out in my previous comment - the one about taking an order snapshot. In such cases, by design, the reports are never to be re-generated because they keep a record of the state of order at a certain time, ie. order placement transition.
When you say
The reports have NEVER been generated without clicking "Generate reports" manually.
do you mean that in your case reports are never GENERATED or never REGENERATED upon the UPDATE? Because if for PLACED orders you still don't see reports UNTIL button in the interface is clicked then yes, there's a bug somewhere :)
- 🇩🇪Germany Anybody Porta Westfalica
Because if for PLACED orders you still don't see reports UNTIL button in the interface is clicked then yes, there's a bug somewhere :)
That's exactly the case. Reports are and were always empty until the reports were generated manually.
But I (and our clients) assumed that's currently by design and you have to generate manually! And that was why we asked for this feature and implemented it.
I'll then start looking for the root cause. Thank you!
Maybe this won't be needed then any more or could be put into a contrib module. - 🇩🇪Germany Grevil
Another person also reported this problem recently, see 💬 Module is not showing results Active .
- Status changed to Closed: works as designed
2 months ago 10:33am 5 February 2025 - 🇩🇪Germany Anybody Porta Westfalica
I made wrong assumptions. Report entries are generated with each event, e,g, new order!
The manual "Generate reports" is just needed front-up or for recalculation. Not in general!So this works as designed and can be closed.