Skip to content

WTEL-9794: Fix Today filter timezone in patchMembers - #358

Open
vlad-marusyk-wt wants to merge 1 commit into
mainfrom
fix/WTEL-9794/patchmember-today-timezone
Open

WTEL-9794: Fix Today filter timezone in patchMembers#358
vlad-marusyk-wt wants to merge 1 commit into
mainfrom
fix/WTEL-9794/patchmember-today-timezone

Conversation

@vlad-marusyk-wt

Copy link
Copy Markdown
Contributor

Проблема

Фільтр today у patchMembers порівнював created_at з now()::date, тобто рахував "сьогодні" за поясом сервера БД (UTC) і ігнорував часовий пояс мембера.

Вирішення

"Сьогодні" тепер обчислюється в поясі мембера: join flow.calendar_timezones по m.timezone_id і порівняння локальних дат через at time zone.

Зміни

  • SqlMemberStore.PatchMembers: доданий join словника поясів

and (:Id::int8 isnull or m.id = :Id::int8)
and (:Today::bool isnull or not :Today::bool or (:Today and m.created_at >= now()::date))
and (:Today::bool isnull or not :Today::bool
or (m.created_at at time zone coalesce(tz.sys_name, 'UTC'))::date = (now() at time zone coalesce(tz.sys_name, 'UTC'))::date)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coalesce(tz.sys_name, 'UTC'))::date

якщо у мембера відсутня часова зона, то вона береться з календаря черги як fallback

)
and (:Name::varchar isnull or m.name ilike :Name)
and (:Id::int8 isnull or m.id = :Id::int8)
and (:Today::bool isnull or (:Today and m.created_at >= now()::date))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут є аналогічний функціонал, тому варто було б це додати в коментарі в джиру, можливо в рамках окремої таски потрібно реалізувати

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants