From 9f9eee0f622899153699ab3d8f857b027da1a580 Mon Sep 17 00:00:00 2001 From: JoshuaMicallefYBSU <91457812+JoshuaMicallefYBSU@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:08:09 +1000 Subject: [PATCH 1/2] Certify Controller & add/Remove Instructor fixups --- .../Controllers/Training/InstructingController.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Training/InstructingController.php b/app/Http/Controllers/Training/InstructingController.php index 1f7b17b3..6ef9bd35 100644 --- a/app/Http/Controllers/Training/InstructingController.php +++ b/app/Http/Controllers/Training/InstructingController.php @@ -488,7 +488,7 @@ public function certifyStudent($cid) } // Unassign Instructor from Student - $instructor_link = InstructorStudentAssignment::where('student_id', $cid); + $instructor_link = InstructorStudentAssignment::where('student_id', $student->id); $instructor_link->delete(); // Create new certification (for home page) @@ -613,7 +613,7 @@ public function assignStudentToInstructor(Request $request, $student_id) $link->save(); // Update Thread Tag - if ($student->user->hasDiscord() && $student->user->member_of_czqo) { + if ($student->user->member_of_czqo) { $discord = new DiscordClient(); $discord->EditThreadTag('In Progress', $student->user->id); } @@ -642,6 +642,12 @@ public function dropStudentFromInstructor($student_id) $label->delete(); } + // Update Thread Tag + if ($student->user->member_of_czqo) { + $discord = new DiscordClient(); + $discord->EditThreadTag('Ready For Pick-Up', $student->user->id); + } + //Assign it with link $link = new StudentStatusLabelLink([ 'student_id' => $student->id, From 2d6f132c7606fce38de1eeb26e8cc4c6116b6970 Mon Sep 17 00:00:00 2001 From: JoshuaMicallefYBSU <91457812+JoshuaMicallefYBSU@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:50:42 +1000 Subject: [PATCH 2/2] Activate Discord User Roles --- app/Console/Kernel.php | 2 +- app/Jobs/UpdateDiscordUserRoles.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 6823eaaf..ff90963c 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -109,7 +109,7 @@ protected function schedule(Schedule $schedule) $schedule->job(new DiscordTrainingWeeklyUpdates())->weeklyOn(6, '6:00'); // Discord role updating - //$schedule->job(new UpdateDiscordUserRoles)->twiceDaily(6, 18); + $schedule->job(new UpdateDiscordUserRoles)->twiceDaily(2, 14); } /** diff --git a/app/Jobs/UpdateDiscordUserRoles.php b/app/Jobs/UpdateDiscordUserRoles.php index ce6a0531..042ced35 100644 --- a/app/Jobs/UpdateDiscordUserRoles.php +++ b/app/Jobs/UpdateDiscordUserRoles.php @@ -101,7 +101,7 @@ public function handle() //Modify $discord->guild->modifyGuildMember($arguments); - /* //Notify them if roles/nickname were change + //Notify them if roles/nickname were change if ($user->fullName('FLC') != $guildMember->nick) { $discord->channel->createMessage([ 'channel.id' => intval($user->discord_dm_channel_id), @@ -115,7 +115,7 @@ public function handle() 'content' => 'Hi there! Your roles on the Gander Oceanic Discord have been updated in line with your roster status. If there is a mistake, please contact the Web Team.' ]); } - */ + //Counter! $counter++; }