Problem
Past Jobs & Quotes on the work order calls GET /past-jobs with zip, city, and street from the current inspection’s property. The backend matches other inspections and quotes by:
property.zip- normalized
property.city - leading street number extracted from
property.streetonly - optional regex on
property.streetfor street name words
It does not use property.unit. For condos and multi-unit buildings where many units share the same street line and unit is stored in property.unit, the list effectively shows all jobs/quotes at that building address, not only the current unit.
Ask
Include unit (apartment/suite/condo unit) in the match logic so Past Jobs & Quotes reflects the same unit when property.unit is present, with sensible behavior when unit is blank or inconsistent (e.g. match building-level history only when unit is empty on both sides, or document the rule).
References
- Frontend:
PastJobsQuotes.tsx— passeszip,city,streetonly today; may need to passunitwhen present. - Backend:
attik-backend/src/routes/pastJobs.ts— aggregation$matchstages;propertySchemaalready has optionalproperty.unit.
Acceptance (draft)
- When both the current job and a candidate job/quote have a non-empty
property.unit, they match only if units align (normalization rules TBD: trim, case,#vsUnitprefix, etc.). - When the current job has no unit, behavior is defined (e.g. keep today’s building-level match, or exclude unit-specific rows — product call).
- Quotes use the same rules as inspections for
property.