Skip to content

Commit

Permalink
Avoid adding empty pending decisions
Browse files Browse the repository at this point in the history
RISDEV-2979
  • Loading branch information
leonie-koch committed Dec 18, 2023
1 parent 8b2614f commit a5f6a8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/ComboboxInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const toggleDropdown = async () => {
if (inputText.value) {
filter.value = inputText.value
}
await updateCurrentItems(filter.value)
await updateCurrentItems()
inputFieldRef.value?.focus()
}
}
Expand All @@ -76,7 +76,7 @@ const showUpdatedDropdown = async () => {
if (inputText.value) {
filter.value = inputText.value
}
await updateCurrentItems(filter.value)
await updateCurrentItems()
}
const clearDropdown = async () => {
Expand All @@ -87,7 +87,7 @@ const clearDropdown = async () => {
inputText.value = ""
focusedItemIndex.value = 0
if (showDropdown.value) {
await updateCurrentItems("")
await updateCurrentItems()
}
inputFieldRef.value?.focus()
}
Expand Down Expand Up @@ -145,7 +145,7 @@ const updateFocusedItem = () => {
if (item && item.innerText !== NO_MATCHING_ENTRY) item.focus()
}
const updateCurrentItems = async (searchStr?: string) => {
const updateCurrentItems = async () => {
hasToUpdate.value = true
if (isUpdating.value && hasToUpdate.value) {
return
Expand Down Expand Up @@ -180,10 +180,12 @@ const updateCurrentItems = async (searchStr?: string) => {
noCurrentlyDisplayeditems.value ||
//no exact match found when add manual entry option set
(props.manualEntry &&
searchStr &&
!currentlyDisplayedItems.value.find((item) => item.label === searchStr))
filter.value &&
!currentlyDisplayedItems.value.find(
(item) => item.label === filter.value,
))
) {
handleNoSearchResults(searchStr)
handleNoSearchResults(filter.value)
} else {
createNewItem.value = undefined
candidateForSelection.value = currentlyDisplayedItems.value[0]
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/domain/ensuingDecision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,8 @@ export default class EnsuingDecision
fieldName: keyof EnsuingDecision,
value: EnsuingDecision[(typeof EnsuingDecision.fields)[number]],
) {
if (fieldName === "pending" && value === true) {
return false
}

if (fieldName === "decisionDate" && this.pending === true) {
return false
if (fieldName === "pending") {
return true
}
if (value === undefined || !value || value === null) {
return true
Expand Down

0 comments on commit a5f6a8e

Please sign in to comment.