export class RdDResolutionTable { static resolutionTable = this.build() /* -------------------------------------------- */ static build() { let table = [] for (var carac = 0; carac <= 30; carac++) { table[carac] = this._computeRow(carac); } return table; } /* -------------------------------------------- */ static _computeRow(carac) { let dataRow = [ this._computeScore(-10, Math.max(Math.floor(carac / 4), 1)), this._computeScore(-9, Math.max(Math.floor(carac / 2), 1)) ] for (var diff = -8; diff <= 22; diff++) { dataRow[diff + 10] = this._computeScore(diff, Math.max(Math.floor(carac * (diff + 10) / 2), 1)); } return dataRow; } static _computeScore(diff, score) { return { niveau: diff, score: score, sign: this._reussiteSignificative(score), part: this._reussitePart(score), epart: this._echecParticulier(score), etotal: this._echecTotal(score) } } static _reussiteSignificative(score) { return Math.floor(score / 2); } static _reussitePart(score) { return Math.ceil(score / 5); } static _echecParticulier(score) { return Math.ceil(score / 5) + 80; } static _echecTotal(score) { return Math.ceil(score / 10) + 91; } /* -------------------------------------------- */ static buildHTMLTable(caracValue, levelValue, minCarac = 1, maxCarac = 21, minLevel = -10, maxLevel = 11) { return this._buildHTMLTable(caracValue, levelValue, minCarac, maxCarac, minLevel, maxLevel) } /* -------------------------------------------- */ static _buildHTMLTable(caracValue, levelValue, minCarac, maxCarac, minLevel, maxLevel) { minCarac = Math.max(minCarac, 1); maxCarac = Math.min(maxCarac, 30); minLevel = Math.max(minLevel, -10); maxLevel = Math.min(maxLevel, 22); var table = $("