Function: enrichGroupUnity()
enrichGroupUnity(
group,messages?,override?,referenceDate?):Group
Defined in: src/utils/group-utils.ts:19
Enriches a group object with the correct display unity percentage, applying overrides and falling back to Firestore values when necessary.
Logic Priority:
- Override (Active chat session updates)
- Calculated (Live client-side calculation from dailyActivity/messages if > 0)
- Firestore (The pre-calculated value from the backend - fallback for mismatches)
CRITICAL: If the Firestore data is from a previous day (stale), it defaults to 0 to ensure an immediate UI reset at midnight.
Parameters
group
messages?
Message[] = []
override?
number
referenceDate?
Date = ...