Skip to content

Commit

Permalink
adjust to only get last day/week
Browse files Browse the repository at this point in the history
  • Loading branch information
green-jay committed Jul 17, 2023
1 parent 3e91a67 commit 5e8755e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion queries/hydradx-ui/v1/statsPeriodic.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ with src_data AS (
ELSE
1=1
END
AND timestamp > (SELECT MAX(timestamp) FROM stats_historical) - interval :sqlQuerySecondsLabel * 60
),
series AS (
SELECT
generate_series(
to_timestamp(floor((extract('epoch' from (SELECT MIN(timestamp) FROM src_data)) / :sqlQuerySeconds )) * :sqlQuerySeconds),
to_timestamp(ceiling((extract('epoch' from (SELECT MIN(timestamp) FROM src_data)) / :sqlQuerySeconds )) * :sqlQuerySeconds),
to_timestamp(floor((extract('epoch' from (SELECT MAX(timestamp) FROM src_data)) / :sqlQuerySeconds )) * :sqlQuerySeconds),
:sqlQuerySecondsLabel
) AS segment
Expand Down

0 comments on commit 5e8755e

Please sign in to comment.