You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specs/011-ride-weather-data/spec.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,9 @@ As a rider creating or editing a ride entry, I want weather details for the ride
17
17
18
18
**Acceptance Scenarios**:
19
19
20
-
1.**Given** a user submits a new ride with a valid ride timestamp and weather data is available, **When** the server processes the save request, **Then** temperature, wind speed, wind direction, humidity, cloud cover, and precipitation type are fetched server-side and stored with the ride created event.
21
-
2.**Given** a user edits an existing ride and updates the ride timestamp, **When** they save, **Then** the server fetches weather for the new time and stores the refreshed values with the ride updated event.
20
+
1.**Given** a user opens the create ride page or edits a ride and chooses to load weather for the selected ride timestamp, **When** the server processes that explicit load-weather request, **Then** temperature, wind speed, wind direction, humidity, cloud cover, and precipitation type are fetched server-side and returned to the form so the fields can be filled before save.
21
+
2.**Given** a user submits a new ride with a valid ride timestamp and weather data is available, **When** the server processes the save request, **Then** temperature, wind speed, wind direction, humidity, cloud cover, and precipitation type are fetched server-side and stored with the ride created event.
22
+
3.**Given** a user edits an existing ride and updates the ride timestamp, **When** they save, **Then** the server fetches weather for the new time and stores the refreshed values with the ride updated event.
22
23
23
24
---
24
25
@@ -32,8 +33,9 @@ As a rider, I want to manually adjust weather fields when automatic values are i
32
33
33
34
**Acceptance Scenarios**:
34
35
35
-
1.**Given** a ride has been saved and its weather values are shown on the ride edit page, **When** the user changes one or more weather fields and saves, **Then** the user-provided values are stored as authoritative and the server does not overwrite them with a new weather fetch.
36
-
2.**Given** automatic weather retrieval fails and a ride is saved with empty weather fields, **When** the user re-opens the ride for editing and enters weather values manually and saves, **Then** those values are stored and displayed for that ride.
36
+
1.**Given** a ride create or edit form is visible, **When** the user clicks the load-weather button and weather data is available, **Then** the returned weather values populate the weather fields without requiring a save.
37
+
2.**Given** a ride has been saved and its weather values are shown on the ride edit page, **When** the user changes one or more weather fields and saves, **Then** the user-provided values are stored as authoritative and the server does not overwrite them with a new weather fetch.
38
+
3.**Given** automatic weather retrieval fails and a ride is saved with empty weather fields, **When** the user re-opens the ride for editing and enters weather values manually and saves, **Then** those values are stored and displayed for that ride.
37
39
38
40
---
39
41
@@ -55,6 +57,7 @@ As a rider repeatedly adding or editing rides for the same date/time context, I
55
57
- Weather provider has no record for the ride timestamp; ride save still succeeds and weather fields remain empty unless user enters values.
56
58
- Weather provider returns only partial weather data; available fields are populated and unavailable fields remain empty.
57
59
- Weather provider is unreachable or times out during server-side fetch; ride save completes and weather fields are stored empty.
60
+
- Weather preview lookup triggered from the form is unreachable or returns no data; the form remains usable and weather fields stay empty.
58
61
- User manually enters or clears a weather field on the edit form; the submitted value (including blank) is preserved and the server does not overwrite it with a fresh weather fetch.
59
62
- Ride time is changed during edit; the server re-fetches weather for the new time at save, but only for fields the user has not manually provided.
60
63
@@ -63,6 +66,8 @@ As a rider repeatedly adding or editing rides for the same date/time context, I
63
66
### Functional Requirements
64
67
65
68
-**FR-001**: The server MUST perform a weather lookup at the time the ride create request is received; the weather fetch MUST support both historical ride times and current/live ride times.
69
+
-**FR-001c**: The system MUST provide an explicit user action on ride create and ride edit forms to load weather for the currently selected ride timestamp before save.
70
+
-**FR-001d**: The explicit load-weather action MUST call the server, not the frontend directly, and MUST fill the weather form fields with returned values when available.
66
71
-**FR-001a**: The weather provider API key MUST be configurable by the user or administrator in the application's settings; the app MUST behave gracefully (empty weather fields, no error blocking save) when no API key is configured.
67
72
-**FR-001b**: Weather fetches MUST be performed server-side only; the API key MUST NOT be exposed to or used by the frontend.
68
73
-**FR-002**: The server MUST perform a weather lookup at the time the ride update request is received when the ride timestamp has changed; the same historical/current support applies.
@@ -81,7 +86,7 @@ As a rider repeatedly adding or editing rides for the same date/time context, I
81
86
82
87
-**Ride Event Weather Snapshot**: Weather attributes stored directly on ride created and ride updated events; includes temperature, wind speed, wind direction, humidity, cloud cover, precipitation type, plus indication of whether values were user-overridden.
83
88
-**Weather Lookup Record**: Reusable stored weather result keyed by ride timestamp rounded to the nearest hour and the user's configured location; includes retrieved weather fields, lookup timestamp, and retrieval status (success/partial/unavailable/error). All ride times within the same hour at the same location share one cache entry.
84
-
-**Ride Entry Form Weather Fields**: Editable fields shown on both create and edit pages. On create, fields start empty and are optionally filled by the user before saving; server auto-fills only unsubmitted fields. On edit, fields are pre-populated with the previously saved weather values so the user can review and override before saving.
89
+
-**Ride Entry Form Weather Fields**: Editable fields shown on both create and edit pages. On create, fields may start empty or with prior ride defaults and can be explicitly filled by a load-weather action before saving; server auto-fills only unsubmitted fields at save. On edit, fields are pre-populated with the previously saved weather values so the user can review, reload weather for the current timestamp, and override before saving.
Copy file name to clipboardExpand all lines: specs/011-ride-weather-data/tasks.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,21 @@
133
133
134
134
---
135
135
136
+
## Phase 7: Explicit Weather Load Actions
137
+
138
+
**Purpose**: Add a user-triggered weather fetch button on create and edit forms that fills weather fields before save.
139
+
140
+
-[X] T047 [P][US1] Update the feature spec for explicit load-weather actions on create and edit forms in `specs/011-ride-weather-data/spec.md`
141
+
-[X] T048 [P][US1] Add backend/frontend contract coverage for a weather preview endpoint in `src/BikeTracking.Api/Contracts/RidesContracts.cs` and `src/BikeTracking.Frontend/src/services/ridesService.ts`
142
+
-[X] T049 [P][US1] Add endpoint coverage for explicit weather loading in `src/BikeTracking.Api.Tests/Endpoints/RidesEndpointsTests.cs`
143
+
-[X] T050 [P][US2] Add frontend tests for load-weather buttons in `src/BikeTracking.Frontend/src/pages/RecordRidePage.test.tsx` and `src/BikeTracking.Frontend/src/pages/HistoryPage.test.tsx`
144
+
-[X] T051 [US1] Add authenticated weather preview endpoint in `src/BikeTracking.Api/Endpoints/RidesEndpoints.cs`
145
+
-[X] T052 [US1] Add create-page load-weather action in `src/BikeTracking.Frontend/src/pages/RecordRidePage.tsx`
146
+
-[X] T053 [US2] Add edit-page load-weather action in `src/BikeTracking.Frontend/src/pages/HistoryPage.tsx`
147
+
-[X] T054 [US1] Update supporting docs/examples for the preview endpoint in `specs/011-ride-weather-data/quickstart.md`, `specs/011-ride-weather-data/contracts/api-contracts.md`, and `src/BikeTracking.Api/BikeTracking.Api.http`
0 commit comments