Skip to content

Opt query activities - #898

Open
AlexCXC wants to merge 3 commits into
masterfrom
opt-query-activities
Open

AlexCXC wants to merge 3 commits into
masterfrom
opt-query-activities

Conversation

@AlexCXC

@AlexCXC AlexCXC commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@AlexCXC
AlexCXC force-pushed the opt-query-activities branch from 4b652f4 to 3e1728d Compare July 23, 2026 06:45

@seafile-dev seafile-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: Request changes

Blocking:

  • The activity-day boundary and cache key are wrong for offsets with non-zero minutes; see the inline comment.

Warnings:

  • No regression coverage was added for cache hit/miss behavior, empty historical days, the current-day bypass, or minute-offset zones.
    Suggested fix: add focused unit tests around the day-range/query helpers and a Redis stub covering +05:30 and -03:30, including an instant that crosses the requested local midnight.

if not match:
raise ValueError("Offset format must be like '+8:00' or '-9:00'")

sign = 1 if match.group(1) == '+' else -1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Critical] 分钟级时区被忽略

Why this matters:
to_tz 来自前端的 dayjs().format().slice(-6),会包含如 +05:30 的有效偏移;这里仅使用小时构造 Etc/GMT,完全丢弃分钟。比如 UTC 18:45 在 +05:30 已是次日 00:15,但实现仍按 +05:00 归到前一天,因此查询范围、返回日期和 Redis key 都会落在错误的自然日,并会把错误统计缓存 24 小时。

Suggested fix: 解析并保留 hours 和 minutes,使用 pytz.FixedOffset(sign * (hours * 60 + minutes))(或等价的固定偏移 tzinfo),并补充跨本地午夜的 +05:30/负分钟偏移回归测试。

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