Let temporary slots override company holiday closures

Objective

  • Keep company holidays as the default closure for normal weekly availability.
  • Allow temporary slots (manual / one-off or recurring extra openings) on a holiday date to supersede that closure so selected inspectors can still be booked.
  • Give schedulers a reliable mixed-holiday workflow without inverted per-inspector block workarounds.

Background

  • Product feedback describes two awkward options today: company Holidays (blocks everyone) or per-inspector blocks/vacations (inverted model when only some people work).
  • Current behavior: holidays are company-wide (holiday model has _companyId only). Scheduling treats holiday dates as closed for all inspectors:
  • calendarAvailabilityIndex.isSlotAvailable returns false on any holiday date.
  • buildSlotsByDateForRange marks projected slots available: false on holidays.
  • Online/internal slot discovery in schedule.ts skips holiday dates entirely when building candidate days.
  • Temporary slots today do not help: manual historic slots (slotOrigin: 'manual' in historicSlots) still pass through the same holiday gate and are blocked. Code review confirmed temporary slots do not currently override holiday closure.
  • Desired direction (product): only temporary slots — not standard recurring weekly inspection slots — should override a company holiday for the inspector(s) who have those openings.

Product Decisions

Locked

  1. Override mechanismTemporary slots supersede company holiday closure for booking availability.
  2. Scope of override — Applies to manual / temporary openings only (slotOrigin: 'manual' historic slots created via inspector temporary-slot UI). Standard weekly template slots remain blocked on holidays.
  3. Default holiday behavior unchanged — Company holidays still close normal availability by default; override is explicit via temporary slot creation.
  4. Problem type — Feature enhancement to scheduling/holiday interaction, not a change to how holidays are stored at company level (unless engineering requires a small schema flag).

Open (Remaining product clarifying decisions)

  1. Online vs internal — Should holiday-overriding temporary slots respect offeredOnline (online scheduler only when true), or should internal scheduler always see them regardless?
  2. Answer: should be visible both online and internal when a temporary slot is added to a holiday date
  3. Holiday date discovery — When temporary slots exist on a holiday, should the scheduler include that holiday date in date search (today it is skipped entirely), or only surface slots when staff navigate to that date manually?
  4. Answer: Automatically include holiday date only for open temporary slots
  5. Recurring temporary series — If a temporary slot is part of a recurring series (temporarySeriesId / temporarySeriesRecurrence), should every occurrence on a holiday override closure, or only explicitly one-off temps?
  6. Answer: all occurances.
  7. Inspector scope — Confirm override is per inspector who has the temporary slot only; other inspectors without a temp slot on that holiday remain closed.
  8. Answer: Correct
  9. UI affordance — Should the temporary-slot UI warn or label that a slot will override a company holiday, so schedulers understand why booking is possible?
  10. Answer: Yes.
  11. Original transcript breadth — The earlier discussion also mentioned general “inspector available on holiday without a temp slot.” Is that out of scope now that the chosen path is temporary-slot override only?
  12. Answer: Out of scope. Let's focus only on Temporary slots.

Scope

Backend — holiday gate (primary change)

  • attik-backend/src/util/functions/slots/calendarAvailabilityIndex.tsisSlotAvailable currently returns false for all slots on holidayDates; needs an exception path for manual/temporary historic slots.
  • attik-backend/src/util/functions/slots/buildSlotsByDateForRange.ts — historic and projected day logic sets available: false when dayIsHoliday; temporary manual slots loaded here must be able to remain available.
  • attik-backend/src/util/functions/slots/weeklySlotProjection.tsprojectFutureDayBucket returns empty holiday buckets; standard weekly projection should stay closed; manual historic slots handled separately.
  • attik-backend/src/util/functions/slots/calcAvailableSlots.ts — maps slots through calendar.isSlotAvailable; must reflect override behavior.
  • attik-backend/src/routes/schedule.tsfindAvailableSlots skips holiday dates when building dates; must include holiday dates when qualifying temporary manual slots exist (or alternate discovery path).
  • attik-backend/src/util/functions/slots/historicSlotsForScheduling.ts — loads manual historic slots for schedule dates; offeredOnline filtering for client-facing scheduler.

Backend — data model

  • attik-backend/src/models/holidaySchema.ts — company-wide holiday records (likely unchanged).
  • attik-backend/src/models/slotsSchema.tsHistoricSlots with slotOrigin: 'manual', temporarySeriesId, temporarySeriesRecurrence, offeredOnline.
  • attik-backend/src/routes/slot.ts — creates/updates manual and temporary slot series.

Frontend

  • attik-frontend/src/app/tools/settings/inspectors/[id]/TemporaryInspectorSlots.tsx — UI for one-off/recurring temporary openings.
  • attik-frontend/src/app/tools/settings/inspectors/[id]/EditTemporarySlotModal.tsx — create/edit including offeredOnline on recurring edits.
  • attik-frontend/src/app/tools/settings/holidays/page.tsx — company holiday management (calendar-admin permission); unchanged authoring, but behavior downstream changes.

Out of scope (unless product expands)

  • Opening standard recurring weekly grid slots on holidays without creating a temporary slot.
  • Per-inspector holiday opt-out lists separate from temporary slots (original transcript option).
  • Changing payroll/forecast holiday handling (payrollContext.ts, getMonthlyForecastRange.ts) unless booking availability changes require it.

References

  • attik-backend/src/util/functions/slots/calendarAvailabilityIndex.ts
  • attik-backend/src/routes/schedule.ts
  • attik-backend/src/models/slotsSchema.ts
  • attik-frontend/src/app/tools/settings/inspectors/[id]/TemporaryInspectorSlots.tsx

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

About 22 hours ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.