Comment 8 for bug 1818917

Revision history for this message
Steven Mayo (stmayo) wrote :

I've taken a swing at this, and think I've gotten something working.
Branch: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/smayo/lp1818917-emergency_closing_adjust_all_fines

I've added to the handler a second query for circs (and reservations) that looks for all circs at the closed org that have bills during the closing.
To my understanding, the hesitancy about doing this is that money.billing and action.circulation are both massive tables, and joining between them without tight constraints tends to be super slow.
Hopefully, by running this query after the first so it has to do that fewer times (and a few other tricks) the additional slowdown is as small as possible.
In my own testing on a mirror of the PINES database, this took 10~15 seconds to process a single-day closing that touched 250 circulations. Seems roughly similar to the old behavior, I think.

Steps to Test:
[1] Find a few patrons who have overdue items with fines on them. They should have more than one item due at the same time for comparison. NOTE: Manually setting an item to be due in the past will not work properly because the patron will not have been fined for them yet. They should have been fined naturally.
[2] Check one of the patron's items in. Note the amount of fines they are charged.
[3] In another tab, go to Administration -> Local Admin -> Closed Dates Editor
[4] Create an emergency closing for the library where the patron checked out their items AFTER their item was due but BEFORE today. (Should also be before the items hit max fines)
[5] Process that closing. Make sure it finishes.
[6] Refresh the first tab. Ensure that the due date of the patron's items was not affected.
[7] Check another one of the patrons items in. Note the amount of fines they are charged - it should be less than the amount they were charged in step [2].
[8] In the second tab, create an emergency closing at the library where the patron checked out their items BEFORE the item was due. Process that closing.
[9] Check another one of the patron's items in. They should be charged the same amount as step [7].
[10] Create and process an emergency closing that INCLUDES the due date of the patron's items.
[11] Refresh the first tab. Ensure the due date of the patron's items has updated.
[12] Check one of the patron's items in. They should be charged even less than steps [7] and [9].