Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-wombats-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@quassel/frontend": patch
---

Fix validation if no carer is selected in Entry form
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
initialValues: {
startedAt: "",
endedAt: "",
carer: 0,
carer: -1,

Check warning on line 56 in apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx

View check run for this annotation

Codecov / codecov/patch

apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx#L56

Added line #L56 was not covered by tests
weekday: 0,
entryLanguages: [{ ratio: 100 }],
},
validate: {
startedAt: isNotEmpty(t.validationNotEmpty),
endedAt: isNotEmpty(t.validationNotEmpty),
carer: isNotEmpty(t.validationNotEmpty),
carer: (value) => (value === -1 || !value ? t.validationNotEmpty : undefined),

Check warning on line 63 in apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx

View check run for this annotation

Codecov / codecov/patch

apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx#L63

Added line #L63 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When someone selected a carer and then empty the input field, the validation isn't triggered. The previously selected carer is used. Maybe this can be improved?

entryLanguages: {
ratio: (value) => {
const fieldError = isInRange({ min: 1, max: 100 }, t.validationRatio)(value);
Expand Down