Day detail page: property picker for quick-add to day queue #237

Closed
opened 2026-06-16 03:32:40 +00:00 by ldraney · 1 comment
Owner

Type

Feature

Lineage

Decomposed from #233 (4 of 4). Depends on #234 (day detail page must exist).

Repo

ldraney/landscaping-assistant

User Story

As a crew lead or admin
I want to search and add properties to a day's queue from the day detail page
So that I can quickly plan work without navigating back to the Today view

Context

The day detail page (#234) shows queued properties but currently has no way to add new ones. This ticket adds a property picker -- the same search/autocomplete pattern used on the Today tab (property_picker_controller.js). Selecting a property creates a WorkQueueItem for the viewed date.

This also serves as the mechanism to re-add properties that were excluded from the "Previously" list (#236) -- adding via the picker overrides any DayExclusion and removes it.

File Targets

Files to modify:

  • app/controllers/days_controller.rb -- add add_to_queue action (POST), loads @properties for the picker dropdown
  • config/routes.rb -- add post "/days/:date/add", to: "days#add_to_queue", as: :day_add
  • app/views/days/show.html.erb -- add property picker form above or within the queued properties section

Files NOT to touch:

  • app/javascript/controllers/property_picker_controller.js -- reuse as-is
  • app/controllers/work_queue_items_controller.rb -- Today tab unchanged

Feature Flag

Flag: none
Additive behavior on the new day detail page.

Acceptance Criteria

  • Property picker search/autocomplete appears on the day detail page
  • Selecting a property creates a WorkQueueItem for the viewed date and adds it to the queued list
  • Properties already queued for the date are marked in the dropdown (prevents duplicates)
  • Turbo stream response appends the new item to the queued list without full page reload
  • If the added property had a DayExclusion for this weekday, the exclusion is removed (re-adds to "Previously" list)

Test Expectations

  • Request spec: POST /days/:date/add with property_id creates a WorkQueueItem for that date
  • Request spec: duplicate add returns error/notice without creating duplicate
  • Request spec: adding a previously excluded property removes the DayExclusion record
  • Request spec: response includes turbo stream that appends the new item
  • Run command: bundle exec rspec spec/requests/days_spec.rb

Constraints

  • Reuse property_picker_controller.js -- same Stimulus controller, same HTML structure
  • Follow the create pattern from WorkQueueItemsController#create for the WorkQueueItem creation
  • The add_to_queue action should handle the case where #236 hasn't landed yet (no DayExclusion table) -- guard with defined?(DayExclusion) or ActiveRecord::Base.connection.table_exists?(:day_exclusions)

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-landscaping-assistant
  • Parent: #233 (decomposed)
  • Depends on: #234 (day detail page)
  • Optional integration with: #236 (DayExclusion cleanup on add)
### Type Feature ### Lineage Decomposed from #233 (4 of 4). Depends on #234 (day detail page must exist). ### Repo `ldraney/landscaping-assistant` ### User Story As a crew lead or admin I want to search and add properties to a day's queue from the day detail page So that I can quickly plan work without navigating back to the Today view ### Context The day detail page (#234) shows queued properties but currently has no way to add new ones. This ticket adds a property picker -- the same search/autocomplete pattern used on the Today tab (`property_picker_controller.js`). Selecting a property creates a `WorkQueueItem` for the viewed date. This also serves as the mechanism to re-add properties that were excluded from the "Previously" list (#236) -- adding via the picker overrides any `DayExclusion` and removes it. ### File Targets Files to modify: - `app/controllers/days_controller.rb` -- add `add_to_queue` action (POST), loads `@properties` for the picker dropdown - `config/routes.rb` -- add `post "/days/:date/add", to: "days#add_to_queue", as: :day_add` - `app/views/days/show.html.erb` -- add property picker form above or within the queued properties section Files NOT to touch: - `app/javascript/controllers/property_picker_controller.js` -- reuse as-is - `app/controllers/work_queue_items_controller.rb` -- Today tab unchanged ### Feature Flag Flag: none Additive behavior on the new day detail page. ### Acceptance Criteria - [ ] Property picker search/autocomplete appears on the day detail page - [ ] Selecting a property creates a `WorkQueueItem` for the viewed date and adds it to the queued list - [ ] Properties already queued for the date are marked in the dropdown (prevents duplicates) - [ ] Turbo stream response appends the new item to the queued list without full page reload - [ ] If the added property had a `DayExclusion` for this weekday, the exclusion is removed (re-adds to "Previously" list) ### Test Expectations - [ ] Request spec: POST `/days/:date/add` with property_id creates a WorkQueueItem for that date - [ ] Request spec: duplicate add returns error/notice without creating duplicate - [ ] Request spec: adding a previously excluded property removes the DayExclusion record - [ ] Request spec: response includes turbo stream that appends the new item - [ ] Run command: `bundle exec rspec spec/requests/days_spec.rb` ### Constraints - Reuse `property_picker_controller.js` -- same Stimulus controller, same HTML structure - Follow the create pattern from `WorkQueueItemsController#create` for the WorkQueueItem creation - The `add_to_queue` action should handle the case where #236 hasn't landed yet (no DayExclusion table) -- guard with `defined?(DayExclusion)` or `ActiveRecord::Base.connection.table_exists?(:day_exclusions)` ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-landscaping-assistant` - Parent: #233 (decomposed) - Depends on: #234 (day detail page) - Optional integration with: #236 (DayExclusion cleanup on add)
Author
Owner

Scope Review: READY

Review note: review-1475-2026-06-15

Scope is solid. All template sections present, traceability complete (story:weekly-tracking verified on project page), file targets accurate (missing files correctly gated by #234 dependency), dependencies well-documented, and the ticket fits in a single agent pass (~3-4 min). No action needed.

## Scope Review: READY Review note: `review-1475-2026-06-15` Scope is solid. All template sections present, traceability complete (story:weekly-tracking verified on project page), file targets accurate (missing files correctly gated by #234 dependency), dependencies well-documented, and the ticket fits in a single agent pass (~3-4 min). No action needed.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/landscaping-assistant#237
No description provided.