Skip to content

Commit

Permalink
Merge pull request #338 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
JoshuaMicallefYBSU authored Aug 30, 2024
2 parents 01c300a + ee06c11 commit 59a5232
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
4 changes: 4 additions & 0 deletions app/Http/Controllers/Training/InstructingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/DiscordTrainingWeeklyUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 11 additions & 4 deletions app/Jobs/ProcessRosterInactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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;
}
}


Expand Down Expand Up @@ -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
);
}
}}

0 comments on commit 59a5232

Please sign in to comment.