From d295352285c6a0b19fb6cc204bb00f4f3928152d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Sun, 2 Aug 2020 16:59:35 +0200 Subject: [PATCH] Add Unpublished publications (publications without DOI) support --- content/dataset.html | 47 ++++++++++++++++++++++++++------------- content/publications.html | 2 +- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/content/dataset.html b/content/dataset.html index a53d1901..d5db919c 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -99,12 +99,12 @@ draft: false var data= await loadAllData() window.defaultDats = [] for (const sub of Object.values(data)) { - for (const doi of uniq(sub.map(d => d.DOI.string))) { - const subdoi = sub.filter(d => d.DOI.string === doi) + for (const doi of uniq(sub.map(d => (d.DOI == null ? "" : d.DOI.string)))) { + const subdoi = sub.filter(d => (d.DOI == null ? "" : d.DOI.string) === doi) for (mol of uniq(subdoi.map(d => d.molecule))) { const submol = subdoi.filter(d => d.molecule === mol) const source = submol.find((d) => { - if (d.DOI.string === "10.1021/acs.jctc.8b01205") { + if ((d.DOI == null ? "" : d.DOI.string) === "10.1021/acs.jctc.8b01205") { return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ" } else { return d.method.isTBE @@ -120,11 +120,24 @@ draft: false window.defaultDats = window.defaultDats.concat(sub) } - await doiCache.addRange(Array.from(new Set(window.defaultDats.map(d=>d.DOI.string)))) + await doiCache.addRange(Array.from(new Set(window.defaultDats.filter(d=>d.DOI!==null).map(d=>d.DOI.string)))) window.defaultDats = window.defaultDats.sort((datfa,datfb)=>{ - const puba = doiCache.get(datfa.DOI.string).format('data', { format: 'object' })[0] - const pubb = doiCache.get(datfb.DOI.string).format('data', { format: 'object' })[0] - return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb) + const DOIa=datfa.DOI + const DOIb=datfb.DOI + if (DOIa == null && DOIb == null) { + return 0 + } + else if (DOIa == null){ + return 1 + } + else if (DOIb == null){ + return -1 + } + else { + const puba = doiCache.get(DOIa.string).format('data', { format: 'object' })[0] + const pubb = doiCache.get(DOIb.string).format('data', { format: 'object' })[0] + return pubUtils.getIssuedDate(puba) - pubUtils.getIssuedDate(pubb) + } }) processingIndicator.isActive = false reloadCustomFiles() @@ -194,7 +207,8 @@ draft: false const sets = await (async () => { if (name === "DOI") { const publis = await getPublis() - const sets = publis.sets + var sets = publis.sets + sets.set("","Unknow set") return sets } else { @@ -238,7 +252,7 @@ draft: false case "basis": return data.method.basis case "DOI": - return data.DOI.string + return data.DOI === null ? "" : data.DOI.string default: return data[name] break; @@ -256,7 +270,7 @@ draft: false if (!(sdatdic.has(key))) { sdatdic.set(key, new Map()) } - const myT1s = T1ref.get(d.DOI.string).get(d.molecule) + const myT1s = T1ref.get(d.DOI == null ? "" : d.DOI.string).get(d.molecule) for (const exc of d.excitations) { var allowT1 = false const T1Key = JSON.stringify((exc.initial, exc.final)) @@ -367,14 +381,14 @@ draft: false }) }) window.T1ref = new Map() - var dois = new Set(window.filtData.map((d) => d.DOI.string)) + var dois = new Set(window.filtData.map((d) =>d.DOI===null ? "" : d.DOI.string)) var mols = new Set(window.filtData.map((d) => d.molecule)) await window.doiCache.addRange(dois) for (const doi of dois) { window.T1ref.set(doi, new Map()) for (const mol of mols) { window.T1ref.get(doi).set(mol, new Map()) - var TBESortdat = window.dats.filter(d => d.DOI.string === doi && d.molecule === mol).sort((d1, d2) => { + var TBESortdat = window.dats.filter(d => (d.DOI === null ? "" : d.DOI.string) === doi && d.molecule === mol).sort((d1, d2) => { if (d1.method.isTBE && !d2.method.isTBE) { return -1 } else if (!d1.method.isTBE && d2.method.isTBE) { @@ -398,7 +412,7 @@ draft: false } } $(sel_ref).empty() - for (const el of uniq(window.filtData.map(d => [d.method, d.DOI.string]))) { + for (const el of uniq(window.filtData.map(d => [d.method, (d.DOI === null ? null : d.DOI.string)]))) { op = $("