From 0e4298a24536f25cacf1aa2ee8514b0729cde55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Tue, 16 Nov 2021 19:24:36 +0900 Subject: [PATCH 1/2] =?UTF-8?q?incomplete=20=E3=81=AE=E3=83=9F=E3=83=BC?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=83=B3=E3=82=B0=E6=95=B0=E3=81=A7=E3=81=99?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/MeetingApprovalsController.php | 10 +++++++++- backend/app/Http/Middleware/NoticeIncomplete.php | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php index d11d0674..4f5f965b 100644 --- a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php +++ b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php @@ -21,7 +21,15 @@ class MeetingApprovalsController extends Controller { if (null !== ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) { foreach ($list as $i => $l) { - $count += MeetingApprovals::where('meeting_id', (int)$l->id)->whereNull('approval_at')->count(); + if (null === ($apr = MeetingApprovals::select('id')->where('meeting_id', (int)$l->id)->get())) { + continue; + } + + if (count($apr) == MeetingApprovals::select('id')->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) { + continue; + } + + $count++; } } diff --git a/backend/app/Http/Middleware/NoticeIncomplete.php b/backend/app/Http/Middleware/NoticeIncomplete.php index 5591d481..30757308 100644 --- a/backend/app/Http/Middleware/NoticeIncomplete.php +++ b/backend/app/Http/Middleware/NoticeIncomplete.php @@ -23,7 +23,15 @@ class NoticeIncomplete if (null !== ($list = Meeting::select('id')->where('father_id', (int)session()->get('fathers')['id'])->get())) { foreach ($list as $i => $l) { - $count += MeetingApprovals::where('meeting_id', (int)$l->id)->whereNull('approval_at')->count(); + if (null === ($apr = MeetingApprovals::select('id')->where('meeting_id', (int)$l->id)->get())) { + continue; + } + + if (count($apr) == MeetingApprovals::select('id')->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) { + continue; + } + + $count++; } } From 58276bc4e59b2be9f3f83bef2e42720253578168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Tue, 16 Nov 2021 19:28:11 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B0=97=E3=81=AB=E5=85=A5=E3=82=8A?= =?UTF-8?q?=E3=81=AE=E3=83=87=E3=83=BC=E3=82=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/MeetingsController.php | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index dbd8b516..adf9383a 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -317,18 +317,14 @@ class MeetingsController extends Controller { continue; } - if (count($l->approvals->toArray()) != MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->count()) { - continue; - } - foreach ($l->approvals as $ii => $ll) { if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) { $ll->child = new \stdClass(); } + } - if (!in_array($l, $result)) { - $result[] = $l; - } + if (!in_array($l, $result)) { + $result[] = $l; } } @@ -355,18 +351,14 @@ class MeetingsController extends Controller { continue; } - if (count($l->approvals) == MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) { - continue; - } - foreach ($l->approvals as $ii => $ll) { if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) { $ll->child = new \stdClass(); } + } - if (!in_array($l, $result)) { - $result[] = $l; - } + if (!in_array($l, $result)) { + $result[] = $l; } }