10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00

Copy excitationType from TBE

This commit is contained in:
Mickaël Véril 2020-01-15 13:10:21 +01:00
parent 10a6482502
commit 8cb95c952b
2 changed files with 23 additions and 2 deletions

View File

@ -68,7 +68,7 @@ draft: false
processingIndicator.isActive = true processingIndicator.isActive = true
var chks = [] var chks = []
var chks = $("#form_datFiles > ul > ul > li >input[type=checkbox]:checked") var chks = $("#form_datFiles > ul > ul > li >input[type=checkbox]:checked")
var proms = Array.from(chks).flatMap((c) => { var proms = Array.from(chks).map((c) => {
switch (c.value) { switch (c.value) {
case "abs": case "abs":
return getAbsFilesName().map((f) => AbsDataFile.loadAsync(f)); return getAbsFilesName().map((f) => AbsDataFile.loadAsync(f));
@ -81,7 +81,18 @@ draft: false
break; break;
} }
}) })
window.dats = await Promise.all(proms) window.dats=[]
for(const subproms of proms){
var sub = await Promise.all(subproms)
for(mol of uniq(sub.map(d=>d.molecule))){
submol=sub.filter(d=>d.molecule==mol)
TBE=sub.find((d)=>d.method.isTBE)
for(dat of submol.filter((d)=>d!==TBE)){
dat.CopyExcitationsTypeFrom(TBE)
}
}
window.dats=window.dats.concat(sub)
}
processingIndicator.isActive = false processingIndicator.isActive = false
reloadFileSelector() reloadFileSelector()
await reloadSelect() await reloadSelect()

View File

@ -207,6 +207,16 @@ class dataFileBase {
this.DOI = null this.DOI = null
this.sourceFile = null this.sourceFile = null
} }
CopyExcitationsTypeFrom(data) {
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))
})
if(ex2!==undefined){
ex.type=ex2.type
}
}
}
static async loadAsync(file) { static async loadAsync(file) {
switch (trueTypeOf(file)) { switch (trueTypeOf(file)) {
case String.name: case String.name: