Commit 90497315 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

Fix level 0 bug

parent 4daddd7e
Pipeline #29497 failed with stages
in 6 minutes and 4 seconds
......@@ -36,7 +36,7 @@
</template>
<script>
import { required } from 'vuelidate/lib/validators'
import { requiredIf } from 'vuelidate/lib/validators'
import MeasureLevelSelector from './MeasureLevelSelector'
export default {
......@@ -51,7 +51,7 @@ export default {
}
},
validations: {
levelSelected: { required }
levelSelected: { required: requiredIf((level)=> { return level !== null }) }
},
computed : {
measureLevel () {
......@@ -60,13 +60,10 @@ export default {
},
watch : {
levelSelected () {
// console.log('watch levelSelected', this.levelSelected)
if (this.levelSelected) {
const evaluation = { ...this.evaluation }
const evaluation = { ...this.evaluation }
evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, actual_level : this.levelSelected }) : m)
this.$store.commit('updateEvaluation', evaluation)
}
evaluation.measure_levels = this.evaluation.measure_levels.map(m => m.measure_id === this.measure.id ? ({...m, actual_level : this.levelSelected }) : m)
this.$store.commit('updateEvaluation', evaluation)
},
evaluation () {
this.levelSelected = this.measureLevel ? this.measureLevel.actual_level : null
......@@ -78,18 +75,13 @@ export default {
},
methods: {
setLevel (num) {
console.log('test', num)
if (this.isEditable) {
this.levelSelected = num
}
},
checkValidation () {
this.$v.$touch()
if (this.$v.$invalid) {
return false
} else {
return true
}
return !this.$v.$invalid;
}
}
}
......
Supports Markdown
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