diff --git a/content/dataset.html b/content/dataset.html index 6ffec757..d0d1cbc9 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -101,9 +101,9 @@ draft: false await loadFiles() } async function loadFiles() { + const db = await indexDB.loadAsync() + const data = await loadAllData() processingIndicator.isActive = true - var data = await loadAllData() - let db = await indexDB.loadAsync() window.defaultDats = [] for (const sub of Object.values(data)) { diff --git a/static/js/data.js b/static/js/data.js index e259d8ff..74b8fe9c 100644 --- a/static/js/data.js +++ b/static/js/data.js @@ -261,17 +261,20 @@ class dataFileBase { }) } CopyExcitationsTypeFrom(data) { + var exc_strings = data.excitations.map( e => [e, JSON.stringify(e.initial), JSON.stringify(e.final) ] ) for (const ex of this.excitations) { - const ex2 = data.excitations.find((e) => { - return (JSON.stringify(e.initial) === JSON.stringify(ex.initial)) && (JSON.stringify(e.final) === JSON.stringify(ex.final)) + const exi = JSON.stringify(ex.initial) + const exf = JSON.stringify(ex.final) + const ex2 = exc_strings.find((e) => { + return (e[1]=== exi) && (e[2]=== exf) }) if (ex2 !== undefined) { if (DebugMode.Enabled) { - const restflag=ex.type.Value & ex2.type.Value + const restflag=ex.type.Value & ex2[0].type.Value const result=restflag==ex.type.Value - console.assert(result, "Excitation type error", data.molecule, ex, ex2, this.sourceFile) + console.assert(result, "Excitation type error", data.molecule, ex, ex2[0], this.sourceFile) } - ex.type = ex2.type + ex.type = ex2[0].type } } } diff --git a/static/js/uniq.js b/static/js/uniq.js index 9c69bf9c..17e067ba 100644 --- a/static/js/uniq.js +++ b/static/js/uniq.js @@ -1,7 +1,7 @@ function uniq(array) { if (array.length == 0) return []; - var sortedArray = array.sort().map( x => [x, JSON.stringify(x)] ); + const sortedArray = array.sort().map( x => [x, JSON.stringify(x)] ); var uniqueArray = [ sortedArray[0][0] ]; for (let i=1 ; i