mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +00:00
Merge "Also count sub-ref re-uses when getting total usages"
This commit is contained in:
commit
b662067c2c
|
@ -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 ] || [];
|
||||||
|
|
Loading…
Reference in a new issue