10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-24 13:23:40 +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
var chks = []
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) {
case "abs":
return getAbsFilesName().map((f) => AbsDataFile.loadAsync(f));
@ -81,7 +81,18 @@ draft: false
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
reloadFileSelector()
await reloadSelect()

View File

@ -207,6 +207,16 @@ class dataFileBase {
this.DOI = 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) {
switch (trueTypeOf(file)) {
case String.name: