Properties tab: proximity-based default sort order #205
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Discovered during schedule digestion discussion -- the boss already groups properties by geographic proximity on his paper schedule, so the digital property list should mirror that mental model.
Repo
ldraney/landscaping-assistantUser Story
As a crew lead
I want properties sorted by geographic proximity by default (not alphabetical)
So that nearby properties are grouped together, matching how I think about my route
Context
The boss's paper schedule groups properties by proximity -- he keeps geographically close properties together even across day boundaries. The current Properties tab sorts alphabetically by
client_name, which scatters nearby properties throughout the list.The Property model already has
latitudeandlongitudefields. Many properties likely have coordinates populated (via the Add Location feature). For properties without coordinates, they fall to the end of the list.The sort should use a nearest-neighbor chain starting from a configurable base point (e.g., the shop/office location, or the first property). This isn't a full traveling-salesman optimization -- just a simple greedy nearest-neighbor traversal that creates natural geographic clusters.
File Targets
Files the agent should modify:
app/controllers/properties_controller.rb-- change default sort from alphabetical to proximityapp/controllers/weeks_controller.rb-- same sort change for week view's property listsapp/models/property.rb-- addscope :by_proximitythat orders by nearest-neighbor chainFiles the agent should NOT touch:
db/schema.rb-- no migration needed, using existing lat/lng fieldsapp/models/work_queue_item.rb-- queue ordering is separate (user-defined via drag)app/controllers/work_queue_items_controller.rb-- sorts byupdated_atfor the add-to-queue dropdown; intentionally different from property browsing sortFeature Flag
Flag: none
This changes the default sort order. If users prefer alphabetical, we can add a toggle later, but the proximity default is the right starting point.
Acceptance Criteria
Test Expectations
Property.by_proximityreturns properties in nearest-neighbor order given known coordinatesbundle exec rspec spec/models/property_spec.rb spec/requests/properties_spec.rbConstraints
Checklist
Related
landscaping-assistant-- project this affectsScope Review: NEEDS_REFINEMENT
Review note:
review-1451-2026-06-13Template complete, file targets verified, story traceability confirmed. Two minor items before READY:
app/controllers/work_queue_items_controller.rbto the "Files the agent should NOT touch" list -- the Today view dropdown sorts by recency intentionally, and an agent could mistakenly apply proximity sort therearch-rails-apparchitecture note does not exist in pal-e-docs (shared gap across many board items, not blocking for this ticket)Scope Review: READY (re-review)
Review note:
review-1451-2026-06-13-r2Previous
[BODY]finding resolved:app/controllers/work_queue_items_controller.rbnow correctly listed in the do-not-touch section.All file targets verified, template complete, traceability confirmed (story note present, arch note still missing but non-blocking). 3 files in 1 repo, 5 AC, well under the 5-minute decomposition threshold. Ticket is ready for implementation.
Validation: PASS
Tiers executed: Tier 1 (local tests), Tier 3 (CI pipeline + route checks)
Validation note:
validation-205-2026-06-135 checks: 5 PASS, 0 FAIL
Evidence summary:
spec/models/property_spec.rb,spec/requests/properties_spec.rb)/properties,/properties/manage,/weeks,/today,/profile): all return HTTP 302 (expected auth redirect), no 500sae62821