Hold request reset entries

Bug #2012669 reported by Llewellyn Marshall
66
This bug affects 14 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Wishlist
Unassigned

Bug Description

Evergreen 3.9.1

I’ve created this pull request for a tool we use frequently at NC Cardinal to answer questions that come up with how the hold targeter behaves. What this feature does is record vital information from a hold every time that it’s reset. It’s especially useful to know this in situations where a patron or staff member wants to know why a copy wasn't chosen for a hold (ex- remote copy was chosen over a local holding). In that scenario, we can use these reset entries to see whether a hold was manually retargeted by a staff member or if it naturally timed out and was retargeted. Reset entries can be viewed in the staff client by going to a patron’s profile and bringing up the “hold details” for their hold. Blake suggested that there would be a lot of value in us sharing this code with the community.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/lew/hold_reset_reason_entries

This setting is controlled by a new global config called “circ.holds.create_reset_reason_entries”. If that flag is disabled then no reset entries will be created.

Reset entries are stored in a new table called "action.hold_request_reset_reason_entry". This is the basic schema of that table:

ID: primary key
Hold: the hold ID
Reset reason: why the hold was reset (see below)
Note: any additional information (like the cancel cause)
Previous copy: the last item that was targeted
Requestor: the user who initiated the reset (if applicable)
Requestor workstation: the workstation of that user

I’ve created an index on the hold field so it’s quicker to retrieve them in the gui.

There are ten hardcoded “reset reasons” stored in a table called action.hold_request_reset_reason

1. HOLD_TIMED_OUT
2. HOLD_MANUAL_RESET
3. HOLD_BETTER_HOLD
4. HOLD_FROZEN
5. HOLD_UNFROZEN
6. HOLD_CANCELED
7. HOLD_UNCANCELED
8. HOLD_UPDATED
9. HOLD_CHECKED_OUT
10. HOLD_CHECKED_IN

Just like copy statuses, hold reset reasons are referenced in the src\perlmods\lib\OpenILS\Const.pm file.

Galen Charlton (gmc)
Changed in evergreen:
importance: Undecided → Wishlist
Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

This looks like a valuable feature to me. I've spent hours checking logs to answer questions about why a hold wasn't filled before also.

I'll try and test it out during bug fixing week. I read through things quickly, and the one thing that seems to be missing is adding the SQL to the seed data files for new installs to get the feature.

Some other good additions would be:
1. Release notes that describe the new feature, where it can be accessed and how to activate it.

2. Testing plan. Some of the conditions are easy enough to trigger for testing, some may be harder to setup a situation for. Any guidance for a tester is appreciated. Notes for each reset reason would be good.

3. Perl live test. I've only written one of those so far, and it can be time consuming to create. But it does provide a great way to ensure that the new feature keeps working in the future when other changes take place. I believe there are a couple examples of perl live tests that place holds that maybe be useful to look at as a starting point. Maybe just extending the hold_targeter test would work. https://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/live_t/20-hold-targeter.t;hb=HEAD

If such a thing was voted on, I would vote to just have this enabled and not need a global setting. Unless there is a performance penalty for the retargeting process that may negatively effect large sites?

Changed in evergreen:
status: New → Confirmed
tags: added: admin-pages circ-holds
Revision history for this message
Llewellyn Marshall (lbmarshallv) wrote :

Thanks for your feedback Josh! I've made a new commit that includes changes in the 950 data seed and 090 schema action sql files. I've added some reset reason documentation to the basic_holds adoc. Lastly, I've made a perl live test that currently covers about half of the hold reset scenarios. I think the other half may be harder to test since they're not triggered by a manual staff action.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=ad46b2cc2d6fbece2aa16097433b6b21e6bd0457

Revision history for this message
Blake GH (bmagic) wrote :

Minor merge conflicts against master today. The SQL bits.

tags: added: needsrebase
Revision history for this message
Llewellyn Marshall (lbmarshallv) wrote :

new commit 3c690bb150f6b3d6316dff74f45fd8fd69f1e806 should merge cleanly onto Master.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=3c690bb150f6b3d6316dff74f45fd8fd69f1e806

Michele Morgan (mmorgan)
tags: removed: needsrebase
Revision history for this message
Susan Morrison (smorrison425) wrote :

Testing for bug squashing, I was able to test all reset reason scenarios, except for HOLD_TIMED_OUT and HOLD_BETTER_HOLD. These are so helpful!

A few comments:
- In the description above, it was noted that the workstation for the user would be listed, but I don't see that column in the Reset Entries tab
- Wondering if it would be possible or helpful to track the following within the HOLD_UPDATED reason to encompass all possible updates: Set Desired Item Quality, Edit Notification Settings, Set and Unset to Top of Queue, and Edit Hold Dates (currently, changing the activation date within Edit Hold Dates results in the HOLD_FROZEN reason, so that wouldn't need to be in HOLD_UPDATED, but I think it could be helpful to know if any of the dates changed and which ones). I love the "pickup_lib value changed" note in HOLD_UPDATED and think that would be very helpful in all update scenarios.
- In the same vein, I think it would be helpful to provide notes for the HOLD_MANUAL_RESET reason; in testing, Mark Item Damaged, Mark Item Missing, and Find Another Target triggered this reason

Revision history for this message
Llewellyn Marshall (lbmarshallv) wrote :

Thanks Susan!
I've made a new commit that adds the requestor workstation name and new notes for marked missing/damaged/discarded.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=424c373cd08ce055df91b09bec3be6071826b68d

Looking at the code it seems like pickup_lib is the only field a staff member can change that would trigger a reset in the hold. While I was testing I noticed that changing item quality triggered a HOLD_MANUAL_RESET so I'll see if I can add additional context to that. Are there any other ways a hold could be reset?

Revision history for this message
Llewellyn Marshall (lbmarshallv) wrote :

Alright, newest commit
https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commit;h=62c818c8ef5c80347bf922d985d0296a83e25567

This is merged with the one above and assigns quality changes, title hold target change, and mark damaged/discard/missing to the HOLD_UPDATED reset reason.

Revision history for this message
Susan Morrison (smorrison425) wrote :

Hi Llewellyn, I'm sorry, I'm just seeing your last question in #6. I do not know other ways holds can be reset. I think all looks great, the only remaining thing I see is that the requestor workstation column is there but doesn't appear to be populating.

Revision history for this message
Blake GH (bmagic) wrote :
Changed in evergreen:
milestone: none → 3.12-beta
Revision history for this message
Terran McCanna (tmccanna) wrote :

I'm getting a conflict when trying to apply to main today. Could you please rebase?

tags: added: needsrebase
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbergja)
Revision history for this message
Jane Sandberg (sandbergja) wrote :

This feature looks great, but the commits are missing your signoff, Llewellyn. Could you please add it? Thanks!

Changed in evergreen:
milestone: 3.12-beta → none
assignee: Jane Sandberg (sandbergja) → nobody
Revision history for this message
Terran McCanna (tmccanna) wrote :

Still needs rebase

Revision history for this message
Blake GH (bmagic) wrote :
Revision history for this message
Blake GH (bmagic) wrote :

Jane,

The sign-offs have been added

Revision history for this message
Mike Rylander (mrylander) wrote :

Blake, that branch looks like it contains a series of partial/conflicted commits and cleanups, back and forth. Will you please squash those down to a minimal number of functionally-focused commits (/maybe/ 2, probably 1 is fine) for code review?

Sorry, but it's really hard to follow what's happening on that branch.

Revision history for this message
Blake GH (bmagic) wrote :

All,

As per Mike's request, I've squashed it down to a single commit. I had the same thoughts but I think I was trying to hang onto the git blame for each of us. I realize that there's a way to push all of one authors commits into a single and the other authors commits into a single, but I'm pretty sure there would be an issue doing that because one commit relied on the other. That's alright, we can blame Llewellyn for the whole patch!

Force pushed.

Revision history for this message
Jason Stephenson (jstephenson) wrote :

Blake, you could add "Co-authored-by: Name <email>" entries for the other authors above the Signed-off-by entries. This way, they'll get some credit in the log, at least.

Revision history for this message
Blake GH (bmagic) wrote :

Jason,

Fair enough, I've done that.

Revision history for this message
Mike Rylander (mrylander) wrote :

Thanks, Blake. That helps a lot. I haven't been through all of it yet, but in the mean time, I have some initial feedback.

For the schema changes, can you change to inline column constraint syntax (our project standard) rather than table constraints? That also helps with quick review and sanity checking. Also, we generally only specify match type, deferrability, and ON-action clauses when they are not the default. As an example, instead of:

create table blah (
  id serial not null,
  other int,
 ...
  constraint blah_pkey primary key (id),
  constraint blah_other_fkey foreign key (other) references foo (id) on update ... on delete ... deferrable ...,
 ...
);

we use this:

create table blah (
  id serial primary key,
  other int not null references foo (id) deferrable initially deferred,
 ...
);

Thanks!

Revision history for this message
Blake GH (bmagic) wrote :

Mike,

That change is on the branch now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.