From cdb5f5978c0dfe24997a0b0569ffd9fdc2ac07ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Wed, 26 Aug 2020 15:04:30 +0200 Subject: [PATCH] Fix error for "Unknow set" (when DOI is not defined in data file) --- content/dataset.html | 16 +++++++++++----- static/js/PubliDB.js | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/content/dataset.html b/content/dataset.html index 498954c8..6aa2ae8c 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -215,6 +215,7 @@ draft: false selects.each(function() { AllValsCache.set(this.name,getAllVals(this)) }) + var AAllValsCache = Array.from(AllValsCache) var vals = uniq(window.dats.filter(d => { return AAllValsCache.every(([k,v]) => { @@ -233,13 +234,18 @@ draft: false if (name === "DOI") { let newvals = [] for (const val of vals) { - for (const set of publis.sets.values()) { - if (set.includes(val)) { - if (!newvals.some(v=>JSON.stringify(v)===JSON.stringify(set))) { - newvals.push(set) + if (val==="") { + newvals.push([""]) + } + else { + for (const set of publis.sets.values()) { + if (set.includes(val)) { + if (!newvals.some(v=>JSON.stringify(v)===JSON.stringify(set))) { + newvals.push(set) + } } } - } + } } vals = newvals } diff --git a/static/js/PubliDB.js b/static/js/PubliDB.js index 4ab901e9..ec8dbcfb 100644 --- a/static/js/PubliDB.js +++ b/static/js/PubliDB.js @@ -27,7 +27,7 @@ class publiDB { return setname } if (supportUnknow && doi === "") { - return UnknowSetName + return publiDB.UnknowSetName } return null }