mirror of
https://github.com/muety/wakapi.git
synced 2025-12-07 23:06:34 -08:00
14 lines
597 B
SQL
14 lines
597 B
SQL
SELECT project, language, editor, operating_system, machine, branch, SUM(diff) as sum
|
|
FROM (SELECT project,
|
|
language,
|
|
editor,
|
|
operating_system,
|
|
machine,
|
|
branch,
|
|
EXTRACT(EPOCH FROM
|
|
LEAST(time - LAG(time) OVER w, INTERVAL '0 minutes')) as diff -- time constant ~ heartbeats padding (none by default, formerly 2 mins)
|
|
FROM heartbeats
|
|
WHERE user_id = 'n1try'
|
|
WINDOW w AS (ORDER BY time)) s2
|
|
WHERE diff IS NOT NULL
|
|
GROUP BY project, language, editor, operating_system, machine, branch; |