|
@@ -282,6 +282,7 @@ class Presence extends Component
|
|
|
$d = $days[$dow];
|
|
$d = $days[$dow];
|
|
|
|
|
|
|
|
$h = date('H:i', strtotime($this->calendar->from));
|
|
$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
|
|
// 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();
|
|
$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::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()
|
|
$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("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])
|
|
|
->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])
|