mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 21:05:15 +00:00
Fix grouped duration_seconds overcounting by using global LAG instead of partitioned LAG (#1075)
This commit is contained in:
parent
9858cec9de
commit
972d6d2e33
1 changed files with 2 additions and 2 deletions
|
|
@ -223,8 +223,8 @@ module Heartbeatable
|
|||
|
||||
capped_diffs = scope
|
||||
.select("#{group_expr} as grouped_time, CASE
|
||||
WHEN LAG(time) OVER (PARTITION BY #{group_expr} ORDER BY time) IS NULL THEN 0
|
||||
ELSE LEAST(time - LAG(time) OVER (PARTITION BY #{group_expr} ORDER BY time), #{timeout})
|
||||
WHEN LAG(time) OVER (ORDER BY time) IS NULL THEN 0
|
||||
ELSE LEAST(time - LAG(time) OVER (ORDER BY time), #{timeout})
|
||||
END as diff")
|
||||
.where.not(time: nil)
|
||||
.unscope(:group)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue