Skip to content

Commit

Permalink
Merge pull request #307 from czqoocavatsim/JoshuaBranch
Browse files Browse the repository at this point in the history
TestAgain
  • Loading branch information
JoshuaMicallefYBSU authored Aug 18, 2024
2 parents e8d2506 + 2a52cac commit 6d963de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function schedule(Schedule $schedule)
$schedule->job(new ProcessSessionReminders())->daily();

// Check Training Threads Status (Once per week)
$schedule->job(new DiscordTrainingUpdates())->weeklyOn(7, '19:28');
$schedule->job(new DiscordTrainingUpdates())->weeklyOn(7, '20:03');

// Discord role updating
//$schedule->job(new UpdateDiscordUserRoles)->twiceDaily(6, 18);
Expand Down
8 changes: 5 additions & 3 deletions app/Jobs/DiscordTrainingUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public function handle()
$response = $discord->getClient()->get('guilds/'.env('DISCORD_GUILD_ID').'/threads/active');
$results2 = json_decode($response->getBody(), true);

// dd($results2);

foreach ($results2['threads'] as $thread) {

// Get the ID of the Active Training Thread
Expand All @@ -102,10 +104,10 @@ public function handle()

// See if user is still a student
if($cid !== null){
$student = Student::whereCurrent(true)->where('user_id', $cid)->firstOrFail();
$student = Student::whereCurrent(true)->where('user_id', $cid)->first();

//Is student already ready for assessment?
if ($student && ($student->hasLabel('In Progress') !== false || $student->hasLabel('Ready For Pick-Up') !== false)) {
//Is the Applied Tag = "In Progress" or "Ready For Pick-Up"?
if ($student && ($thread['applied_tags'] == "1271846369510035627" || $thread['applied_tags'] == "1271847420631978107")) {

// Check Sessions Upcoming
$upcoming_sessions = TrainingSession::where('student_id', $student->id)->whereBetween('scheduled_time', [Carbon::now(), Carbon::now()->addDays(7)])->first();
Expand Down

0 comments on commit 6d963de

Please sign in to comment.