Skip to content

Commit 90f0b08

Browse files
kenkooooclaude
andcommitted
fix: max_streaks の二重タイムゾーン変換によるストリーク計算バグを修正
`AT TIME ZONE 'UTC'` の後に `AT TIME ZONE 'Asia/Tokyo'` を連鎖させると、 一度naiveなtimestampに変換された値を「これはJSTの時刻表記だ」と再解釈して しまい、意図した+9時間ではなく-9時間の変換になっていた。 結果、UTC 9-15時台(JSTの夜、コンテスト時間帯)に行われた提出だけ 偶然日付が一致し、それ以外の時間帯(日中の精進や早朝の提出など)は solve_date が1日ずれて計算され、本来連続しているストリークが streak_groups の判定で途切れてしまっていた。 Fixes #1549 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rK811gLsFrY6BiaZYYUW7
1 parent b57d591 commit 90f0b08

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dbt/models/marts/max_streaks.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ daily_solves as (
1515
-- Convert to JST date (epoch + 9 hours, then truncate to day)
1616
select distinct
1717
user_id,
18-
(to_timestamp(first_ac_epoch) at time zone 'UTC' at time zone 'Asia/Tokyo')::date as solve_date
18+
(to_timestamp(first_ac_epoch) at time zone 'Asia/Tokyo')::date as solve_date
1919
from first_ac_per_problem
2020
),
2121

0 commit comments

Comments
 (0)