Cheapest reference uses chosen miles radius (same pool as list) in app + widget; header shows 'within N miles'
This commit is contained in:
@@ -85,10 +85,11 @@ struct FuelPriceTimelineProvider: TimelineProvider {
|
||||
}
|
||||
|
||||
// 3) Load stations, then sort by price (distance tiebreak), scoped to
|
||||
// the alert trigger radius so the widget's "cheapest" matches the app.
|
||||
// the chosen search radius (miles) so the widget's "cheapest" matches
|
||||
// the app's list.
|
||||
var stations = FuelStore.loadStations()
|
||||
if stations.isEmpty { stations = SampleFuelProvider.sampleStations }
|
||||
let radiusKM = FuelStore.loadAlertsRadius()
|
||||
let radiusKM = Double(FuelStore.loadStationLimit()) * 1.60934 // miles → km
|
||||
if let location {
|
||||
let within = stations.filter {
|
||||
$0.distanceKM(to: location.lat, lng2: location.lng) <= radiusKM
|
||||
|
||||
Reference in New Issue
Block a user