Problem/Motivation
For the site I'm working on we need a usage-count filter in the media view. Unfortunately, the current solution has no easy way to distinguish between usage in a previous or the latest revision.
Steps to reproduce
Track usages of revisionable entities. Add a view with a filter on the sum of count or count/distinct of source_id. The usages of previous versions are also counted.
Proposed resolution
Track 'is latest revision' in the entity_usage table.
Remaining tasks
Review, tests, etc
User interface changes
None
API changes
\Drupal\entity_usage\EntityUsage::registerUsage method signature has changed.
Data model changes
New column in the entity_usage table 'source_is_latest_revision'
Issue fork entity_usage-3274971
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
spadxiii commentedComment #4
Anonymous (not verified) commentedPatch applied but it still counts previous versions. If there are 4 revisions, it shows 1 usage as like 4.
Comment #6
dmundraThank you @theloneliestmonk for rebasing. I think it would be also good to fix the errors in the merge request.
Comment #7
alexpottI'm not sure I see how this works. As you add new revisions to a node won't all the entries into the entity usage table be marked as the latest revision?