Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: The behavior of today's statistics causes yesterday's data to … #473

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MessageDream
Copy link
Contributor

close #471

我已确认该 PR 已自测通过,相关截图如下:
image

问题原因:
以东8区为例,凌晨的数据在数据库(TZ=UTC)执行sql格式化日期的时候,会格式化成上一日的,统计出的数据包含上一日统计数据,通过ON CONFLICT会覆盖。
image
image
修正后:
image

@MartialBE
Copy link
Owner

MartialBE commented Jan 26, 2025

也不能这样直接增加,如果数据库时区已经设置是 东八区,就会出现问题。
应该在数据库中直接设置好时区,或者在程序初始化数据库InitDB函数中配置时区

@MartialBE
Copy link
Owner

我在 数据库链接时 增加了 时区参数, 会读取 TZ环境变量。 你看看还有没有问题
786f33b

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.

定时数据统计bug
2 participants