diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 57a8d2d6..7f4ff3e8 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -42,7 +42,7 @@ protected function schedule(Schedule $schedule) $schedule->job(new ProcessSessionLogging())->everyMinute(); //Inactivity checks - $schedule->job(new ProcessRosterInactivity())->dailyAt('7:00'); + $schedule->job(new ProcessRosterInactivity())->dailyAt('8:05'); //CRONS FOR INACTIVITY EMAILS 2 weeks // $schedule->call(function () { diff --git a/app/Http/Controllers/Training/InstructingController.php b/app/Http/Controllers/Training/InstructingController.php index 6ef9bd35..af2f76a0 100644 --- a/app/Http/Controllers/Training/InstructingController.php +++ b/app/Http/Controllers/Training/InstructingController.php @@ -395,6 +395,10 @@ public function removeStudent($cid) //Find student $student = Student::where('user_id', $cid)->firstOrFail(); + // Delete Roster Entry + $roster = RosterMember::where('cid', $cid)->firstOrFail(); + $roster->delete(); + //Make as not current $student->current = false; diff --git a/app/Jobs/DiscordTrainingWeeklyUpdates.php b/app/Jobs/DiscordTrainingWeeklyUpdates.php index 806b2e03..4ef689dc 100644 --- a/app/Jobs/DiscordTrainingWeeklyUpdates.php +++ b/app/Jobs/DiscordTrainingWeeklyUpdates.php @@ -128,7 +128,7 @@ public function handle() $avail_message++; // // SendEmbed to ask student to send availability - $discord->sendEmbedInTrainingThread($cid, "Please Provide Availability", 'Hello, <@'.$student->discord_id.'> + $discord->sendEmbedInTrainingThread($cid, "Please Provide Availability", 'Hello, <@'.$student->discord_user_id.'> As we head into the Weekend, we ask you please provide your availability for next week. Please ensure to tag the `@Instructor` role with all times you are available. Please provide these times in Zulu Format. diff --git a/app/Jobs/ProcessRosterInactivity.php b/app/Jobs/ProcessRosterInactivity.php index 8dc587b4..1288f324 100644 --- a/app/Jobs/ProcessRosterInactivity.php +++ b/app/Jobs/ProcessRosterInactivity.php @@ -67,7 +67,7 @@ public function handle() // Check if there was a last session - if($last_session != null){ + if($last_session != null && $roster->certification === "certified"){ // Currency is less than 1 hour and last connection was 305 days ago. if($roster->active && $currency < 1 && $last_session->created_at->diffInDays(now()) == 305){ @@ -108,7 +108,9 @@ public function handle() // No Session was returned within the last 365 Days. } else { - $removeController = true; + if($roster->certification === "certified"){ + $removeController = true; + } } @@ -139,7 +141,12 @@ public function handle() } // Send Web Notification if any changes have been made - - + $discord = new DiscordClient(); + $discord->sendMessageWithEmbed(env('DISCORD_WEB_LOGS'), 'AUTO: Roster Inactivity Update', +'60 Days till Removed: '.$first_notice.' +30 Days till Removed: '.$second_notice.' +7 Days till Removed: '.$third_notice.' +Removed from Roster: '.$termination_notice +); } }}