Fix planning controller (generate planning for current week if missing)

This commit is contained in:
Jérémy Munsch 2021-10-02 14:04:43 +02:00
parent f208ab5740
commit ac8bb4e726
No known key found for this signature in database
GPG key ID: 55196BEE445F6049

View file

@ -23,7 +23,7 @@ class PlanningController extends Controller
->with('user')->get();
foreach ($userIds as $id) {
// auto create missing planning for user
if ($date >= Carbon::now() and !$weeks->contains('user.id', $id)) {
if ($date >= Carbon::now()->startOfWeek() and !$weeks->contains('user.id', $id)) {
$wp = new WeekPlanning([
'start' => $date,
'planning' => WeekPlanning::getWeekBlock($date),