UPDATE_ACTIVITY_BIT
All functions > BUSINESS_ACTIVITY > UPDATE_ACTIVITY_BIT
Returns the activity bits for the given activity bits and whether the current day is active.
Syntax
UPDATE_ACTIVITY_BIT(activity_bits: BIGINT, is_active: BOOLEAN) → BIGINT
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
activity_bits | BIGINT | Yes | Current bit-packed activity representation |
is_active | BOOLEAN | Yes | Whether user was active today |
Returns
BIGINT - Updated activity bits with today's activity
Notes
- Updates activity bits for current day (shifts left and adds new bit)
- Shifts all bits left by 1 position (aging the data)
- Sets bit 0 based on is_active parameter
- Preserves the "active before" flag in bit 56
- Used for incremental daily activity tracking
- Maintains sliding 56-day window
- Efficiently updates without reconstructing from dates