Skip to content

Pool together unused aircraft#140

Open
Bohaska wants to merge 2 commits intomyflyclub:masterfrom
Bohaska:patch-20
Open

Pool together unused aircraft#140
Bohaska wants to merge 2 commits intomyflyclub:masterfrom
Bohaska:patch-20

Conversation

@Bohaska
Copy link
Copy Markdown

@Bohaska Bohaska commented Apr 26, 2025

Let you select all unused aircraft when making/editing routes, even if the airplane is not at the origin airport. If you try to edit a route by adding an unused airplane that's in another airport, the game automatically tries to move that airplane first, then does the change.

Adds all aircraft without any assignments as available for link editing, even if home airport is not the same as link.from

Automatically attempts to move aircraft if home airport does not match link.from
Copy link
Copy Markdown
Collaborator

@spencerm spencerm left a comment

Choose a reason for hiding this comment

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

This is a great QoL feature / idea, however this would add many database calls.

I haven't tried this / looked into it at all – but can we just have a fake "pool" airport for unused aircraft? New planes get added to the pool airport and then assigned to an actual airport when then they're assigned. Would also make explaining the deprecation under "other income" easier.

return BadRequest(s"Cannot insert link - airplane $airplane is not based in ${incomingLink.from}")
if (airplane.home.id != incomingLink.from.id) { // plane home airport does not match link origin airport
// check if it is unused and can be moved
val currentAssignments = AirplaneSource.loadAirplaneLinkAssignmentsByAirplaneId(airplane.id) // load fresh assignments
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is going to add an additional database operation for every single airplane as long as the airports don't match.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

true, but you only do that operation like once for each airplane you buy and then later assign, I don't expect airports not matching to be a relatively common thing to see


// Perform airplane moves before link update
if (airplanesToUpdate.nonEmpty) {
AirplaneSource.updateAirplanesDetails(airplanesToUpdate.toList)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a bit awkward where we're moving planes (and more problematically, doing a db operation) even if they don't need to move.

@Bohaska
Copy link
Copy Markdown
Author

Bohaska commented May 21, 2025

for context, this new AI agent service gave me $50 in free credits and I gave it my github account and it looked for open PRs I had with comments on them to fix, this came up first, so I tried using it...

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.

3 participants