From 030d66d3dc7d1068009fb5e96a16c1ef6009ba10 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Fri, 29 Mar 2024 11:06:55 +0100 Subject: [PATCH] Report just once --- src/SolutionRank.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SolutionRank.mjs b/src/SolutionRank.mjs index 6c7b77e..86fb66c 100644 --- a/src/SolutionRank.mjs +++ b/src/SolutionRank.mjs @@ -271,14 +271,20 @@ export class SolutionRank { } calculate() { - if (this._preferencesToBeRanked.size > 0) { + if (this._preferencesToBeRanked.size > 0 && !reportedCalculateWarningFor.has(this.title)) { console.warn( `For ${this.title} there are ${this._preferencesToBeRanked.size} preferences not ranked: ${Array.from( this._preferencesToBeRanked, ).join(', ')}`, ); + reportedCalculateWarningFor.add(this.title); } return this; } } + +/** + * @singleton + */ +let reportedCalculateWarningFor = new Set();