https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31051 --- Comment #44 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #41)
2. MySQL (and DBIC) has ways to calculate this SUM in a single DB query. So we shouldn't need to look trough many checkouts and items summing things in checkouts+old_checkouts DB queries. This is a blocker in my opinion. Happy to guide/help if needed.
I submitted a candidate patch that makes things a bit more optimal. We could still make some joins to have a single query, but this is much better on its own.
1. I expected to see some 'DISTINCT' in the queries, or a 'uniq' in the code. Because I'm not sure how the saving should be counted (i.e. if the book is recalled and I need to borrow it again, then I didn't save two times the replacement prince, but one). I guess this is subject to debate so I would mark 'In discussion' until this is settled.
My implementation does what I think we should do. So letting the bug 'In discussion' until this is settled. Otherwise it would be ready. -- You are receiving this mail because: You are watching all bug changes.