Web Client: Offline Issue Affects System where child orgs have lower ID number than parent

Bug #1770478 reported by Scott Thomas
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
High
Unassigned
3.0
Fix Released
High
Unassigned

Bug Description

Our consortia has 4 Org Unit tiers. Our consolidated library systems have their branches placed in the 4th (bottom) tier. In the Web Client, these 4th Tier org units do not appear under Working Location.

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

Scott, I've edited the title of the bug to provide a bit more info up front.

General info: I'm still looking for the cause and fix on this one, but the problem is definitely specific to the situation where a child org has a numerically lower ID than its parent. This will happen when a new org unit is created with a high ID and existing org units with lower IDs are move under the new one.

If anyone else wants to look into this, please do not let the fact that I am also stop you! The more eyes on this the better.

summary: - Web Client: Offline Issue Affects System with 4 Org Unit Tiers
+ Web Client: Offline Issue Affects System where child orgs have lower ID
+ number than parent
no longer affects: evergreen/master
Changed in evergreen:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Mike Rylander (mrylander) wrote :

Also, AFAICT, this /only/ affects the offline Working Location dropdown at the top of the page.

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

I think the issue is with the filter() call in reconstituteTree in lovefield.js. The test for that call always returns false for org units matching this SQL query:

select id, shortname, parent_ou from actor.org_unit where id::text < parent_ou::text;

The filter() call iterates through the org unit list in (string-sorted) order, applying this test:

kid[parent_field]() == item[pkey]()

Initially, this test is always false because the left-hand value is a function and the right-hand value is a string/number. But that ceases to be the case once filter() iterates past the org unit whose children we're looking for; after that, the test returns true for org units where parent_ou = item.id, false otherwise.

I also tried to summarize this finding in IRC, with bonus console logging:

http://irc.evergreen-ils.org/evergreen/2018-05-14#i_358706

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

Here's a branch that addresses this issue:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/lp-1770478-offline-org-tree

From the commit message:

A thinko in the org tree reconstruction for offline mode caused the tree to be
broken in some situations, when the orgs were not ordered strictly by ID in
the list stored in the browser's IndexedDB storage. This commit removes that
requirement, and allows trees of any ID and storage ordering to be
reconstituted.

tags: added: pullrequest
Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Thanks Mike! The fix works for me -- all org units now appear in the offline working location dropdown. Signoff here:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jeffdavis/lp-1770478-offline-org-tree-signoff

The org units are weirdly sorted compared to the org selector elsewhere, but that's a separate bug.

Changed in evergreen:
milestone: none → 3.2-beta
assignee: nobody → Jason Stephenson (jstephenson)
Revision history for this message
Jason Stephenson (jstephenson) wrote :

We tested this branch at C/W MARS and it resolves our issues with all org. units showing up in offline circulation. I've added my sign-off and pushed to master, rel_3_1, and rel_3_0.

Thanks, Jeff and Mike!

Changed in evergreen:
assignee: Jason Stephenson (jstephenson) → nobody
status: Confirmed → Fix Committed
no longer affects: evergreen/3.1
Changed in evergreen:
milestone: 3.2-beta → 3.1.2
status: Fix Committed → Fix Released
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.