Week tab: show unassigned properties section #34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "30-week-unassigned-properties"
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?
Summary
Splits the Week tab grid into scheduled (assigned) and unassigned sections, sorts by client name, and swaps the primary display from address to client_name.
Changes
app/controllers/weeks_controller.rb-- Sort byLOWER(client_name)instead ofaddress_line; compute@assignedand@unassignedfrom scheduled IDsapp/views/weeks/index.html.erb-- Grid iterates@assignedonly; client_name is primary label; new "Unassigned" section below grid with empty stateapp/assets/stylesheets/application.css-- Added.unassigned-section,.unassigned-list,.unassigned-item,.unassigned-item-info,.unassigned-item-metastyles following existing patternsTest Plan
Review Checklist
Related Notes
None.
Related
Closes #30
QA Review
Reviewed the diff across all 3 files. Implementation matches issue #30 spec exactly.
Findings
No blocking issues.
Minor observations (non-blocking):
Semantic class name drift --
.week-grid-clientnow renders the address (secondary meta) rather than client name. Not worth renaming since it would expand scope, but worth noting for future refactors.Test coverage gap -- The existing
weeks_spec.rbtest "shows active properties" passes incidentally (address text appears in unassigned section), but there is no explicit test for the new@assigned/@unassignedsplit behavior. Consider adding coverage in a follow-up.Checklist
VERDICT: APPROVE
PR #34 Review
DOMAIN REVIEW
Stack: Ruby on Rails (controller, ERB views, CSS)
Controller logic (
weeks_controller.rb):scheduled_ids = @completions.keys | @queued.keys-- correctly computes the union of all property IDs with any work queue item (completed or queued) for the week.@assigned = @properties.where(id: scheduled_ids)and@unassigned = @properties.where.not(id: scheduled_ids)-- correct ActiveRecord pattern. Handles the empty-array edge case properly: when no items exist for the week,where(id: [])returns empty relation andwhere.not(id: [])returns all active properties (everything unassigned).Arel.sql("LOWER(client_name)")-- acceptable for case-insensitive sorting. Sinceclient_nameis validated as present on the model, no NULL ordering concern here.@propertiesrelation is still used for@total_activecount, which remains correct (counts all active properties, not just assigned ones).View (
weeks/index.html.erb):property.address_line.presence || "No address yet"-- nil-safe. Schema showsaddress_lineis nullable (nonull: falseconstraint), so this is correct and necessary.@assignedinstead of@properties, so only scheduled properties get the day columns. Good.CSS (
application.css):.unassigned-itemmirrors.manage-itempattern (flex, border-bottom, spacing-md). Consistent with existing conventions.var(--spacing-xl),var(--spacing-md),var(--color-border),var(--color-muted)-- all existing design tokens.Regressions check:
@total_completedstill uses@completions.keys.countwhich counts unique properties with at least one completion -- unchanged and correct.@propertiesis kept as the base for counting, so the "X/Y completed" summary remains accurate across all active properties.BLOCKERS
None.
The test coverage question is nuanced: existing
spec/requests/weeks_spec.rbtests will continue to pass because:However, there are no new tests for the unassigned section specifically. This is borderline but NOT a blocker because:
where/where.notsplit with no complex branching.I would recommend (as a nit) adding a test that verifies the unassigned section renders when a property has no work queue items, but this is not blocking.
NITS
Test gap (low risk): Consider adding a request spec that verifies:
DRY opportunity: The
property.address_line.presence || "No address yet"pattern appears twice (once in the grid row, once in the unassigned list). Could be extracted to a helper method (e.g.,property_address_display(property)) inApplicationHelper. Not critical at 2 occurrences, but worth noting if this pattern spreads further.Semantic HTML: The unassigned section uses
<h2 class="section-heading">-- verify that the existingsection-headingclass is defined. If not, this heading will render with browser defaults. (I see it is likely defined elsewhere in the stylesheet given the pattern, but worth confirming visually.)Existing test update opportunity: The test
"shows active properties"(line 14 of weeks_spec.rb) now implicitly tests the unassigned section since the property has no work queue items. The test description is slightly misleading post-change. Consider renaming to something like"shows active properties in unassigned section"for clarity.SOP COMPLIANCE
30-week-unassigned-propertiesfollows{issue-number}-{kebab-case-purpose}PROCESS OBSERVATIONS
VERDICT: APPROVED