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

Bug: T373023
Change-Id: I12a37be8a1e26d25b152eb929f41188675e35038
This commit is contained in:
WMDE-Fisch 2024-10-31 15:13:22 +01:00
parent e4e6b59306
commit 76aa5d9cb4

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 ] || [];