A rule the session already read counts as opened when it arrives again #229
@@ -9,8 +9,12 @@ is stamped opened as it is written (`rule_deliveries._read_already`). This
|
||||
stamps the deliveries already recorded the same way, so the open rates, the
|
||||
adherence readout and the weighing pass read one definition across old and
|
||||
new rows: a rule read early in a session is not counted unread each time it
|
||||
arrives again. The stamp is the delivery's own time. Not reversible: the
|
||||
downgrade leaves the stamps, which the earlier code reads as ordinary opens.
|
||||
arrives again. The stamp is the delivery's own time. Only rows that carry a
|
||||
plugin version are touched: every reader skips the others
|
||||
(`rule_deliveries.REPORTS_OPENS`), and they are most of the table, so the
|
||||
lookup runs on the few rows recorded since 0133 rather than on all of them.
|
||||
Not reversible: the downgrade leaves the stamps, which the earlier code reads
|
||||
as ordinary opens.
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
@@ -26,6 +30,7 @@ def upgrade() -> None:
|
||||
UPDATE rule_deliveries d
|
||||
SET opened_at = d.delivered_at
|
||||
WHERE d.opened_at IS NULL
|
||||
AND d.plugin IS NOT NULL
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM rule_deliveries e
|
||||
WHERE e.user_id = d.user_id
|
||||
|
||||
Reference in New Issue
Block a user