DSpace / DSpace

(Official) The DSpace digital asset management system that powers your Institutional Repository
https://wiki.lyrasis.org/display/DSDOC7x/
BSD 3-Clause "New" or "Revised" License
855 stars 1.29k forks source link

Fix Item Counts (webui.strengths) by refactoring ItemCounter and ItemCountDAO to act like other Spring beans #9583

Closed tdonohue closed 1 month ago

tdonohue commented 1 month ago

References

Description

This PR refactors the ItemCounter and ItemCountDAO to be Spring beans defined in core-services.xml. This fixes issues with Item Counts not reloading & issues where it was not possible to use live, database-based counts (via webui.strengths.cache=false).

This refactor involved the following:

Instructions for Reviewers

damian-joz commented 1 month ago

Hi @tdonohue, I've started testing phase. I've noticed that when item is withdrawn, the counter still include it. I've done some small fix for that. Can I push it directly to your branch?

tdonohue commented 1 month ago

@damian-joz : If GitHub allows you to push to my branch, then please feel free. If it doesn't allow you, then you could send me a PR to my branch (by creating at PR against my GitHub account: https://github.com/tdonohue/DSpace), or send me the code.

Thanks for testing & for finding a fix to the issue you discovered!

damian-joz commented 1 month ago

@tdonohue I've created a PR to your branch. I've also tested a few scenarios:

both for cache(Solr) and non cache solution(Database query) and it works fine. Sometimes it required the refresh of the UI.

Just one thing worth to mention, when we will map item to another collection we end up with something like this: image. And for some users it can be confusing because community counter is not even with the sum of collection counters. However it is ok because Collection 1 has 3 items with one item shared between collections.

tdonohue commented 1 month ago

I've merged the improvements that @damian-joz made in https://github.com/tdonohue/DSpace/pull/15 to this branch. Those are now included in this PR.

As @damian-joz has given approval (thanks!), I'll give this another test on my end to make sure everything still works well (after this most recent update). Assuming everything is working well, I'll get this merged for 8.0 and backported to 7.x

dspace-bot commented 1 month ago

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-9583-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-9583-to-dspace-7_x
git switch --create backport-9583-to-dspace-7_x
git cherry-pick -x 78f1e4190e0f48bc707416968033578d6ce12b9c d07aab6025a4e23be767146e03bc1964169c8a30 a4c297c94728d17081260e60cb0bc498d7f92a8d 01be5eee419b9d79192ed55a927a4b271a094bb0