Make station price age informational only
The relay's price_updated is the maximum price_last_updated across the grades it maps, so it cannot vouch for the selected grade: stop using it to score, gate or warn about Best Value. - FuelPriceFreshness is now station-level and display-only: one age per station, fresh/outdated/unknown/invalid, "May be outdated" past 30 days, with future-tolerance and non-finite guards. - Best Value restores the closest-station-selling-the-selected-fuel baseline and its savings ranking; eligibility gating, eligible-first sorting and the unavailable banner are gone. - Price age appears in the More info sheet only - no listing-row warnings, no extra banners. - Copy reverted from "closest eligible station" to "closest station"; stale price-confidence strings removed, "May be outdated" added. - Dormant per-grade timestamp plumbing removed, and regression tests added for every fuel type, missing/invalid/future stamps and the bundled offline dump.
This commit is contained in:
@@ -203,8 +203,6 @@ struct FuelPriceTimelineProvider<Configuration: WidgetConfigurationIntent & Widg
|
||||
// 3) Load + order stations per widget mode.
|
||||
let ordered: [FuelStation]
|
||||
var bestValueResult: FuelSavingsResult?
|
||||
var bestValuePriceConfidence: FuelPriceFreshness.ComparisonConfidence = .ineligible
|
||||
var bestValuePriceWarning: String?
|
||||
if isFavourites {
|
||||
let favourites = FuelStore.loadFavourites()
|
||||
.filter { $0.station.prices[$0.fuel] != nil }
|
||||
@@ -308,8 +306,7 @@ struct FuelPriceTimelineProvider<Configuration: WidgetConfigurationIntent & Widg
|
||||
break
|
||||
}
|
||||
let amount = settings.preferredAmount
|
||||
let baseline = FuelSavingsEstimator.bestValueBaselineStation(filtered, fuel: fuel,
|
||||
journeyMiles: journey)
|
||||
let baseline = FuelSavingsEstimator.baselineStation(filtered, fuel: fuel, journeyMiles: journey)
|
||||
let ranked = FuelSavingsEstimator.ranked(
|
||||
filtered,
|
||||
fuel: fuel,
|
||||
@@ -320,13 +317,6 @@ struct FuelPriceTimelineProvider<Configuration: WidgetConfigurationIntent & Widg
|
||||
)
|
||||
ordered = ranked
|
||||
if let first = ranked.first, let baseline {
|
||||
bestValuePriceConfidence = FuelPriceFreshness.comparisonConfidence(
|
||||
station: first, fuel: fuel, baseline: baseline)
|
||||
bestValuePriceWarning = FuelPriceFreshness.comparisonWarning(
|
||||
station: first, fuel: fuel, baseline: baseline)
|
||||
}
|
||||
if let first = ranked.first, let baseline,
|
||||
bestValuePriceConfidence != .ineligible {
|
||||
let baselineJourney = journey(baseline)
|
||||
let result = FuelSavingsEstimator.availability(
|
||||
station: first,
|
||||
@@ -358,9 +348,7 @@ struct FuelPriceTimelineProvider<Configuration: WidgetConfigurationIntent & Widg
|
||||
date: Date(), stations: Array(ordered.prefix(8)),
|
||||
fuel: fuel, sort: sort, isFavourites: isFavourites,
|
||||
location: origin, locationSource: source,
|
||||
unit: unit, bestValueResult: bestValueResult,
|
||||
bestValuePriceConfidence: bestValuePriceConfidence,
|
||||
bestValuePriceWarning: bestValuePriceWarning
|
||||
unit: unit, bestValueResult: bestValueResult
|
||||
)
|
||||
), originSource)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user