Skip to content
Snippets Groups Projects
Commit bd5a6fc3 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

Fix if evaluation has no danger_levels.

parent 8e59fa85
No related branches found
Tags v2.3.1
No related merge requests found
Pipeline #28609 failed
......@@ -21,14 +21,20 @@ export default {
computed: {
level: {
get() {
return this.evaluation.danger_levels && this.evaluation.danger_levels.find(d => d.danger_id === this.danger.id) ? this.evaluation.danger_levels.find(d => d.danger_id === this.danger.id).id : null
if (this.evaluation.danger_levels.length) {
this.evaluation.danger_levels = this.$store.state.dangers.all.map(d => {
return {danger_id: d.id}
})
} else {
}
},
set(level) {
const evaluation = {...this.evaluation}
console.log('changing level', level)
console.log('eval before', evaluation.danger_levels)
console.log('this.danger.id', this.danger.id)
evaluation.danger_levels = this.evaluation.danger_levels.map(dl => {
if (dl.danger_id === this.danger.id) {
return {danger_id: dl.danger_id, id: level}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment