Merge "Also count sub-ref re-uses when getting total usages"

This commit is contained in:
jenkins-bot 2024-11-01 10:12:27 +00:00 committed by Gerrit Code Review
commit b662067c2c

View file

@ -217,7 +217,11 @@ ve.dm.MWGroupReferences.prototype.getTotalUsageCount = function ( listKey ) {
const mainRefsCount = mainRefs.length; const mainRefsCount = mainRefs.length;
const subrefs = this.getSubrefs( listKey ); const subrefs = this.getSubrefs( listKey );
const subrefsCount = subrefs.length;
let subrefsCount = 0;
subrefs.forEach( ( node ) => {
subrefsCount += this.getRefUsages( node.getAttribute( 'listKey' ) ).length;
} );
const totalUsageCount = mainRefsCount + subrefsCount; const totalUsageCount = mainRefsCount + subrefsCount;
@ -226,7 +230,7 @@ ve.dm.MWGroupReferences.prototype.getTotalUsageCount = function ( listKey ) {
/** /**
* @param {string} parentKey parent ref key * @param {string} parentKey parent ref key
* @return {ve.dm.MWReferenceNode[]} List of subrefs for this parent * @return {ve.dm.MWReferenceNode[]} List of subrefs for this parent not including re-uses
*/ */
ve.dm.MWGroupReferences.prototype.getSubrefs = function ( parentKey ) { ve.dm.MWGroupReferences.prototype.getSubrefs = function ( parentKey ) {
return this.subRefsByParent[ parentKey ] || []; return this.subRefsByParent[ parentKey ] || [];