Commit 4e43bdea authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Added a safeguard against completely missing section_run to the overview page.

parent a95a9a05
Pipeline #97904 passed with stages
in 22 minutes and 19 seconds
...@@ -168,11 +168,19 @@ export default function DFTEntryOverview({data}) { ...@@ -168,11 +168,19 @@ export default function DFTEntryOverview({data}) {
let structs = {} let structs = {}
const url = `/entry/id/${data.upload_id}/${data.calc_id}/archive` const url = `/entry/id/${data.upload_id}/${data.calc_id}/archive`
// Check that at least one section run is available. If not, break the execution.
let section_run = archive?.section_run
if (section_run) {
const nRuns = section_run.length
section_run = section_run[nRuns - 1]
} else {
return
}
// Figure out what properties are present by looping over the SCCS. This // Figure out what properties are present by looping over the SCCS. This
// information will eventually be directly available in the ES index. // information will eventually be directly available in the ES index.
let e_dos = null let e_dos = null
let e_bs = null let e_bs = null
const section_run = archive.section_run[0]
let section_method = null let section_method = null
const sccs = section_run.section_single_configuration_calculation const sccs = section_run.section_single_configuration_calculation
if (sccs) { if (sccs) {
...@@ -394,14 +402,12 @@ export default function DFTEntryOverview({data}) { ...@@ -394,14 +402,12 @@ export default function DFTEntryOverview({data}) {
structs.conventional = ideal structs.conventional = ideal
} }
setStructures(structs) setStructures(structs)
setLoading(false)
}).catch(error => { }).catch(error => {
setLoading(false)
if (error.name === 'DoesNotExist') { if (error.name === 'DoesNotExist') {
} else { } else {
raiseError(error) raiseError(error)
} }
}) }).finally(() => setLoading(false))
}, [data, api, raiseError, setElectronicStructure, setStructures]) }, [data, api, raiseError, setElectronicStructure, setStructures])
const quantityProps = {data: data, loading: !data} const quantityProps = {data: data, loading: !data}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment