From fe373efab685960f5617a6971ef4951a5f5ab5f5 Mon Sep 17 00:00:00 2001 From: MouseOfLight <MouseOfLight@gmail.com> Date: Sun, 29 Dec 2019 14:41:52 -0800 Subject: [PATCH] Added handling for NumericRange objects to the Rules Assistant summary. Added fallback stringify for other objects. --- src/js/rulesAssistant.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js index 2e2a2961d33..3fcdded2876 100644 --- a/src/js/rulesAssistant.js +++ b/src/js/rulesAssistant.js @@ -498,15 +498,22 @@ window.RASummaryCell = function() { } function ruleSetValueToString(v) { - if (typeof v === 'object' && v.hasOwnProperty('cond') && v.hasOwnProperty('val')) { - return `<nowiki>${v.cond}</nowiki> ${v.val}`; + if (typeof v === 'object') + { + if(v.hasOwnProperty('cond') && v.hasOwnProperty('val')) { + return `<nowiki>${v.cond}</nowiki> ${v.val}`; + } else if(v.hasOwnProperty('min') && v.hasOwnProperty('max')) { + return `${v.min} to ${v.max}`; + } else { + return JSON.stringify(v); + } } return `${v}`; } let r = `<td>${path.join('.')}</td>`; for (const cell of cells) { - r += cell !== null ? `<td>${ruleSetValueToString(cell)}</td>` : '<td/>'; + r += cell !== null ? `<td>${ruleSetValueToString(cell)}</td>` : '<td></td>'; } table.push(r); } -- GitLab