Avoid claiming unused aircraft

Probably the final Fix #97
Unused aircraft (assigned upon takeoff) would get claimed but since it's not possible to delete those flights after aborting, these flights wouldn't get released anymore. This should fix that issue, including a migrator change to correct the number of claimed aircraft per squadron.
This commit is contained in:
Raffson
2023-05-01 16:06:20 +02:00
parent 31cfc333c7
commit b4b19d3ad5
5 changed files with 16 additions and 3 deletions

View File

@@ -56,13 +56,15 @@ class Flight(SidcDescribable, RadioFrequencyContainer, TacanContainer):
frequency: Optional[RadioFrequency] = None,
channel: Optional[TacanChannel] = None,
callsign: Optional[str] = None,
claim_inv: bool = True,
) -> None:
self.id = uuid.uuid4()
self.package = package
self.country = country
self.coalition = squadron.coalition
self.squadron = squadron
self.squadron.claim_inventory(count)
if claim_inv:
self.squadron.claim_inventory(count)
if roster is None:
self.roster = FlightRoster(self.squadron, initial_size=count)
else: