Commit c4bf3749 authored by Magnus Holm Brunbjerg's avatar Magnus Holm Brunbjerg
Browse files

fix

parent 9c428ee7
......@@ -146,22 +146,30 @@ app.route('/experiments/:id')
* Show issues for a specific experiment
*/
.get((req, res, next) => {
// Get from db
fetch(`${api}/experiments/${req.params.id}/issues`, standardGet)
// Get experiment from db
fetch(`${api}/experiments/${req.params.id}`, standardGet)
.then((response) => {
if (response.status === 200) { return response.json() }
})
.then((issues) => {
for (let i = 0; i < issues.length; i++) {
issues[i].start_time = new Date(issues[i].start_time).toLocaleString('en-GB', { hour12: false })
issues[i].end_time = new Date(issues[i].end_time).toLocaleString('en-GB', { hour12: false })
}
res.render('issues', {
meta: {
title: 'Problemer'
},
issues: issues
})
.then((experiment) => {
// Get issues from db
fetch(`${api}/experiments/${req.params.id}/issues`, standardGet)
.then((response) => {
if (response.status === 200) { return response.json() }
})
.then((issues) => {
for (let i = 0; i < issues.length; i++) {
issues[i].start_time = new Date(issues[i].start_time).toLocaleString('en-GB', { hour12: false })
issues[i].end_time = new Date(issues[i].end_time).toLocaleString('en-GB', { hour12: false })
}
res.render('issues', {
meta: {
title: 'Problemer'
},
issues: issues,
experiment: experiment
})
})
})
})
......
<h1>Problemer</h1>
{{#if issues}}
<p>Navn: {{experiment.name}}</p>
<p>Start: {{experiment.start_time}}</p>
<p>Slut: {{experiment.end_time}}</p>
<div style="position: relative; height:40vh; width:80vw">
<canvas id="issues-chart"></canvas>
</div>
......
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