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

Conversation

BossOfGames
Copy link
Contributor

@BossOfGames BossOfGames commented Feb 6, 2024

This PR resolves an issue where the nightly cron sets the visibility of flights created and owned by modules. This functionality is not exactly desired, as module developers would need to setup a cron event to set the flights back to their desired settings.

@nabeelio
Copy link
Owner

nabeelio commented Mar 5, 2024

@BossOfGames I forgot what we decided about this

@BossOfGames
Copy link
Contributor Author

BossOfGames commented Mar 7, 2024 via email

@FatihKoz
Copy link
Contributor

Why not

$flights = Flight::where('active', 1)->whereNull('owner_type')->get();

This will eliminate already inactive flights and the ones owned by a 3rd party module in the beginning.

Current implementation will still handle the visibility of 3rd party flights even this PR gets merged if there are days provided for the "owned" flight.

This will allow module developers to handle their flights separately and improve resource usage by skipping inactive flights at query level.

If a setting or config variable is required, we can simply change the query instead of function coding. Also this must be documented properly so addon developers can check it before applying/implementing their own scripts.

@BossOfGames
Copy link
Contributor Author

Why not

$flights = Flight::where('active', 1)->whereNull('owner_type')->get();

This will eliminate already inactive flights and the ones owned by a 3rd party module in the beginning.

Current implementation will still handle the visibility of 3rd party flights even this PR gets merged if there are days provided for the "owned" flight.

This will allow module developers to handle their flights separately and improve resource usage by skipping inactive flights at query level.

If a setting or config variable is required, we can simply change the query instead of function coding. Also this must be documented properly so addon developers can check it before applying/implementing their own scripts.

I agree with this better. I have updated the PR to reflect this suggestion.

Copy link
Contributor

@arthurpar06 arthurpar06 left a comment

Choose a reason for hiding this comment

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

If you want CI/CD to pass you should change this line:

'owner_type' => Flight::class,

and set owner_type to null because in fact v7 sets it to null and not Flight::class when we create a Flight

@@ -43,10 +43,7 @@ public function checkFlights(): void
if (!$flight->active) {
continue;
}

// Set to visible by 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?

@BossOfGames
Copy link
Contributor Author

If you want CI/CD to pass you should change this line:

'owner_type' => Flight::class,

and set owner_type to null because in fact v7 sets it to null and not Flight::class when we create a Flight

Didn't realize that code was there. I have corrected that, as well as fixed the removal of setting visible to true by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants