Bug 31437

Summary: ModItemTransfer triggers indexing twice
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart, lucas, martin.renvoize, nick, tomascohen
Version: unspecifiedKeywords: rel_22_11_candidate
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25754
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Circulation function:
Bug Depends on: 30718, 24446    
Bug Blocks:    
Attachments: Revert "Bug 30718: (follow-up) index_records is called more times than we thought"
Bug 31437: (bug 30718 follow-up) Prevent useless indexation call from ModDateLastSeen
Revert "Bug 30718: (follow-up) index_records is called more times than we thought"
Bug 31437: (bug 30718 follow-up) Prevent useless indexation call from ModDateLastSeen

Description Tomás Cohen Arazi (tcohen) 2022-08-22 14:25:34 UTC
After 30718 ModItemTransfer leads to two calls on index_records. I bisected it down to 48bf9b1d91dbbc336f859ac1a83d7d25b0e6a3c1 but couldn't figure how that change is relevant. My gut feeling is that we were somehow hidding an error and the change to DateTime 'fixed' it. The code clearly yields to two calls to index_records as ->transit calls ModDateLastSeen without passing the skip_record_index flag.

I added a follow-up on bug 30718 to fix the tests and expect we make a decision here.

This bug could be replaced by bug 25754 as this needs a final refactoring removing it IMHO.
Comment 1 Jonathan Druart 2022-10-14 09:07:31 UTC
Created attachment 141866 [details] [review]
Revert "Bug 30718: (follow-up) index_records is called more times than we thought"

This reverts commit 35165e5f13ec11a62dea7f6b129f7f07c7ecb7f4.
Comment 2 Jonathan Druart 2022-10-14 09:07:35 UTC
Created attachment 141867 [details] [review]
Bug 31437: (bug 30718 follow-up) Prevent useless indexation call from ModDateLastSeen

Koha::Object->store is triggering an UPDATE because the datelastseen is
different than the value in DB (comparing a datetime with a date)
Comment 3 Tomás Cohen Arazi (tcohen) 2022-10-14 12:23:30 UTC
Created attachment 141874 [details] [review]
Revert "Bug 30718: (follow-up) index_records is called more times than we thought"

This reverts commit 35165e5f13ec11a62dea7f6b129f7f07c7ecb7f4.

https://bugs.koha-community.org/show_bug.cgi?id=31437
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2022-10-14 12:23:35 UTC
Created attachment 141875 [details] [review]
Bug 31437: (bug 30718 follow-up) Prevent useless indexation call from ModDateLastSeen

Koha::Object->store is triggering an UPDATE because the datelastseen is
different than the value in DB (comparing a datetime with a date)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Tomás Cohen Arazi (tcohen) 2022-10-14 12:33:41 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!