mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Make the chore assignment type "Random" more random (closes #674)
This commit is contained in:
parent
9d7ca55109
commit
5421dfb6b2
@ -112,6 +112,7 @@
|
||||
|
||||
### Chores improvements/fixes
|
||||
- Changed that not assigned chores on the chores overview page display now just a dash instead of an ellipsis in the "Assigned to" column to make this more clear (thanks @Germs2004)
|
||||
- The assignment type "Random" now don't prevents anymore that the last user will be assigned next
|
||||
- Fixed (again) that weekly chores, where the next execution should be in the same week, were scheduled (not) always (but sometimes) for the next week only (thanks @shadow7412)
|
||||
- Fixed that the assignment type "In alphabetic order" did not work correctly (the last person in the list was always assigned next once reached) (thanks @fipwmaqzufheoxq92ebc)
|
||||
|
||||
|
@ -40,7 +40,6 @@ class ChoresService extends BaseService
|
||||
}
|
||||
|
||||
$nextExecutionUserId = null;
|
||||
|
||||
if ($chore->assignment_type == self::CHORE_ASSIGNMENT_TYPE_RANDOM)
|
||||
{
|
||||
// Random assignment and only 1 user in the group? Well, ok - will be hard to guess the next one...
|
||||
@ -50,11 +49,7 @@ class ChoresService extends BaseService
|
||||
}
|
||||
else
|
||||
{
|
||||
// Randomness in small groups will likely often result in the same user, so try it as long as this is the case
|
||||
while ($nextExecutionUserId == null || $nextExecutionUserId == $lastDoneByUserId)
|
||||
{
|
||||
$nextExecutionUserId = $assignedUsers[array_rand($assignedUsers)]->id;
|
||||
}
|
||||
$nextExecutionUserId = $assignedUsers[array_rand($assignedUsers)]->id;
|
||||
}
|
||||
}
|
||||
elseif ($chore->assignment_type == self::CHORE_ASSIGNMENT_TYPE_IN_ALPHABETICAL_ORDER)
|
||||
|
Loading…
x
Reference in New Issue
Block a user