Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cron to Set Flights Visible to True Only When Owned By The Core #1770

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this should be removed ?
Since you have changed the query above, we are necessarily in the case where the flight belongs to v7, so why change the logic?


// 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
Loading