I checked the code to see how the changes in airplane models would affect my planes' depreciation and I found the code I copied below. Because of the change in the price of the 96-400s, their current values are going to be depreciated a **** ton more based on the model's new value. This would mean that it's value would eventually reach zero or negative before they are renewed and it'd be possible that we're going to pay much more than list price to renew this plane. Please have a look
def computeDepreciationRate(model : Model, decayRate : Double) = {
val depreciationRate = (model.price * (decayRate / 100)).toInt
depreciationRate
}
def decayAirplanesByAirline(airplanesWithAssignedLink : Map[Airplane, LinkAssignments], owner : Airline) : List[Airplane] = {
...
val newCondition = airplane.condition - decayRate
val depreciationRate = computeDepreciationRate(airplane.model, decayRate)
val newValue = airplane.value - depreciationRate
updatingAirplanes.append(airplane.copy(condition = newCondition, depreciationRate = depreciationRate, value = newValue))
}
updatingAirplanes.toList
}
Good catch! I will patch the DB and increase the value of those existing airplanes. Many thanks!