Browse Source

presence - controllo ora fine corso

ferrari 3 weeks ago
parent
commit
5a2e1580f1
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/Http/Livewire/Presence.php

+ 2 - 1
app/Http/Livewire/Presence.php

@@ -282,6 +282,7 @@ class Presence extends Component
             $d = $days[$dow];
 
             $h = date('H:i', strtotime($this->calendar->from));
+            $h_to = date('H:i', strtotime($this->calendar->to));
 
             // Elenco corsi per tipologia in base al calendario
             $courses = \App\Models\Course::where('name', $this->calendar->name)->where('date_from', '<=', $this->calendar->from)->where('date_to', '>=', $this->calendar->to)->pluck('id')->toArray();
@@ -299,7 +300,7 @@ class Presence extends Component
 
             // $members_courses = \App\Models\MemberCourse::whereRaw("JSON_CONTAINS(`when`, JSON_OBJECT('day', JSON_ARRAY(?), 'from', ?), '$')", [$d, $h])->where('months', 'like', '%"m":' . $months . ',%')->whereIn('course_id', $courses)->pluck('member_id')->toArray();
             $members_courses = \App\Models\MemberCourse::query()
-                ->whereRaw("JSON_CONTAINS(`when`, JSON_OBJECT('day', JSON_ARRAY(?), 'from', ?), '$')", [$d, $h])
+                ->whereRaw("JSON_CONTAINS(`when`, JSON_OBJECT('day', JSON_ARRAY(?), 'from', ?, 'to', ?), '$')", [$d, $h, $h_to])
                 ->whereRaw("JSON_CONTAINS(months, JSON_OBJECT('m', CAST(? AS UNSIGNED)), '$')", [$months])
                 ->whereRaw("NOT JSON_CONTAINS(months, JSON_OBJECT('m', CAST(? AS UNSIGNED), 'status', 2), '$')", [$months])
                 ->whereRaw("NOT JSON_CONTAINS(months, JSON_OBJECT('m', CAST(? AS UNSIGNED), 'status', '2'), '$')", [$months])