Skip to content

Commit

Permalink
Fix Cron to Set Flights Visible to True Only When Owned By The Core (n…
Browse files Browse the repository at this point in the history
…abeelio#1770)

* Set Visible to True Only When Owned By The Core

* Better Syntax

* Ammended based on Dispo's Feedback

* Applied changes based on feedback.

* Corrected Logic. Corrected database seeder for Flights

* Fix for style-cl

---------

Co-authored-by: Nabeel S. <nabeelio@users.noreply.github.com>
  • Loading branch information
BossOfGames and nabeelio authored Nov 12, 2024
1 parent accf667 commit e723ee7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/Cron/Nightly/SetActiveFlights.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(CronNightly $event): void
public function checkFlights(): void
{
$today = Carbon::now('UTC');
$flights = Flight::all();
$flights = Flight::where('active', 1)->whereNull('owner_type')->get();

/**
* @var Flight $flight
Expand All @@ -43,8 +43,7 @@ public function checkFlights(): void
if (!$flight->active) {
continue;
}

// Set to visible by default
// Set visible default
$flight->visible = true;

// dates aren't set, so just save if there were any changes above
Expand Down
2 changes: 1 addition & 1 deletion app/Database/factories/FlightFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function definition(): array
DateTime::ATOM
),
'updated_at' => static fn (array $flight) => $flight['created_at'],
'owner_type' => Flight::class,
'owner_type' => null,
'owner_id' => null,
];
}
Expand Down

0 comments on commit e723ee7

Please sign in to comment.