allow create task assigned to anyone

This commit is contained in:
Mo Tarbin
2026-07-30 20:29:17 -04:00
parent 19ed0ba3ab
commit eb088a259a

View File

@@ -631,18 +631,18 @@ const ChoreEdit = () => {
}, [frequencyType]) }, [frequencyType])
useEffect(() => { useEffect(() => {
if (assignees.length === 0) { if (anyone || assignableTo.length === 0) {
setAssignStrategy('no_assignee') setAssignStrategy('no_assignee')
setAssignedTo(null) setAssignedTo(null)
} else { } else {
if (!assignees.some(a => a.userId === assignedTo)) { if (!assignableTo.some(a => a.userId === assignedTo)) {
setAssignedTo(assignees[0].userId) setAssignedTo(assignableTo[0].userId)
} }
if (assignStrategy === 'no_assignee') { if (assignStrategy === 'no_assignee') {
setAssignStrategy(ASSIGN_STRATEGIES[2]) // default to least_completed setAssignStrategy(ASSIGN_STRATEGIES[2]) // default to least_completed
} }
} }
}, [assignStrategy, assignedTo, assignees]) }, [assignStrategy, assignedTo, assignableTo, anyone])
// useEffect(() => { // useEffect(() => {
// if (performers.length > 0 && assignees.length === 0 && userProfile) { // if (performers.length > 0 && assignees.length === 0 && userProfile) {
@@ -1257,7 +1257,7 @@ const ChoreEdit = () => {
)} )}
</Box> </Box>
{assignees.length > 1 && ( {!anyone && assignableTo.length > 1 && (
<> <>
<Box mb={3}> <Box mb={3}>
<Typography level='h4'>Currently Assigned To</Typography> <Typography level='h4'>Currently Assigned To</Typography>
@@ -1795,13 +1795,13 @@ const ChoreEdit = () => {
<FormControl> <FormControl>
<Radio <Radio
overlay overlay
disabled={assignees.length === 0} disabled={anyone || assignableTo.length === 0}
value={true} value={true}
label='Limited' label='Limited'
/> />
<FormHelperText> <FormHelperText>
You and others that are assigned to the task You and others that are assigned to the task
{assignees.length === 0 {anyone || assignableTo.length === 0
? ' (No assignees selected, Limited option is disabled)' ? ' (No assignees selected, Limited option is disabled)'
: ''} : ''}
</FormHelperText> </FormHelperText>