Skip to content

Commit

Permalink
improve form status combo code
Browse files Browse the repository at this point in the history
  • Loading branch information
bikubi committed Sep 9, 2024
1 parent 910e5c5 commit b8ffde1
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions frontend/javascript/components/postupload/post-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,14 @@ const formStatusWasResolved = formStatus.value === 'resolved'
const formStatusIsResolved = computed(() => formStatus.value === 'resolved')
// remove nonsensical combos
const formStatusChoices = computed(() =>
props.status_form.fields.resolution.choices.filter((choice) => {
if (formIsSent.value) {
switch (choice.value) {
case '':
case 'successful':
case 'partially_successful':
case 'not_held':
case 'refused':
return false
}
} else {
if (choice.value === 'user_withdrew_costs') return false
}
return true
})
)
const formStatusChoices = computed(() => {
const badCombinations = formIsSent.value
? ['', 'successful', 'partially_successful', 'not_held', 'refused']
: ['user_withdrew_costs']
return props.status_form.fields.resolution.choices.filter(
(choice) => !badCombinations.includes(choice.value)
)
})
const formCost = props.status_form.fields.costs.initial?.intValue || 0
const formHasHadCost = formCost > 0
Expand Down

0 comments on commit b8ffde1

Please sign in to comment.