SpeciesFileGroup/taxonworks

View on GitHub
app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/mutations/setCharacterStateChecked.js

Summary

Maintainability
A
0 mins
Test Coverage
import mergeIntoObservation from '../helpers/mergeIntoObservation'
import setDescriptorUnsaved from '../helpers/setDescriptorUnsaved'

export default function (state, args) {
  const {
    descriptorId,
    characterStateId,
    isChecked
  } = args

  const observation = state.observations
    .find(o => o.descriptorId === descriptorId && o.characterStateId === characterStateId)

  mergeIntoObservation(observation, { isChecked, isUnsaved: true })
  setDescriptorUnsaved(state.descriptors.find(d => d.id === descriptorId))
};