Skip to content

Commit 7826135

Browse files
author
aligneddev
committed
weather call fix
1 parent df8712f commit 7826135

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/BikeTracking.Api/Application/Rides/WeatherLookupService.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,17 @@ ILogger<OpenMeteoWeatherLookupService> logger
110110
: $"&apikey={Uri.EscapeDataString(apiKey)}";
111111

112112
// Build query parameters
113-
var pastDaysParam =
114-
isHistorical || daysDiff < 0 ? "" : $"&past_days={Math.Min(daysDiff + 1, 92)}";
113+
// Note: past_days is mutually exclusive with start_date/end_date on the Open-Meteo API.
115114
var queryParams =
116115
$"?latitude={Uri.EscapeDataString(latitude.ToString(CultureInfo.InvariantCulture))}"
117116
+ $"&longitude={Uri.EscapeDataString(longitude.ToString(CultureInfo.InvariantCulture))}"
118117
+ $"&start_date={dateTimeUtc.Date:yyyy-MM-dd}"
119118
+ $"&end_date={dateTimeUtc.Date:yyyy-MM-dd}"
120-
+ $"{pastDaysParam}"
121119
+ "&hourly=temperature_2m,wind_speed_10m,wind_direction_10m,relative_humidity_2m,cloud_cover,precipitation,weather_code"
122120
+ "&temperature_unit=fahrenheit"
123121
+ "&wind_speed_unit=mph"
124122
+ "&timezone=auto"
125123
+ apiKeyParam;
126-
127124
try
128125
{
129126
var client = httpClientFactory.CreateClient(clientName);

0 commit comments

Comments
 (0)