(leaderboards): Update to support sessions.
Use `member_totals` to generate leaderboards instead of `members`. Fix typo in data coin conversion.
This commit is contained in:
@@ -77,7 +77,7 @@ AS $$
|
||||
) SELECT
|
||||
guildid, userid, channelid, channel_type, start_time,
|
||||
total_duration, total_stream_duration, total_video_duration, total_live_duration,
|
||||
(total_duration * hourly_coins + live_duration * hourly_live_coins) / 60
|
||||
(total_duration * hourly_coins + live_duration * hourly_live_coins) / 3600
|
||||
FROM current_sesh
|
||||
RETURNING *
|
||||
)
|
||||
@@ -108,7 +108,7 @@ CREATE VIEW members_totals AS
|
||||
*,
|
||||
sesh.start_time AS session_start,
|
||||
tracked_time + COALESCE(sesh.total_duration, 0) AS total_tracked_time,
|
||||
coins + COALESCE((sesh.total_duration * sesh.hourly_coins + sesh.live_duration * sesh.hourly_live_coins) / 60, 0) AS total_coins
|
||||
coins + COALESCE((sesh.total_duration * sesh.hourly_coins + sesh.live_duration * sesh.hourly_live_coins) / 3600, 0) AS total_coins
|
||||
FROM members
|
||||
LEFT JOIN current_sessions_totals sesh USING (guildid, userid);
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ AS $$
|
||||
) SELECT
|
||||
guildid, userid, channelid, channel_type, start_time,
|
||||
total_duration, total_stream_duration, total_video_duration, total_live_duration,
|
||||
(total_duration * hourly_coins + live_duration * hourly_live_coins) / 60
|
||||
(total_duration * hourly_coins + live_duration * hourly_live_coins) / 3600
|
||||
FROM current_sesh
|
||||
RETURNING *
|
||||
)
|
||||
@@ -544,7 +544,7 @@ CREATE VIEW members_totals AS
|
||||
*,
|
||||
sesh.start_time AS session_start,
|
||||
tracked_time + COALESCE(sesh.total_duration, 0) AS total_tracked_time,
|
||||
coins + COALESCE((sesh.total_duration * sesh.hourly_coins + sesh.live_duration * sesh.hourly_live_coins) / 60, 0) AS total_coins
|
||||
coins + COALESCE((sesh.total_duration * sesh.hourly_coins + sesh.live_duration * sesh.hourly_live_coins) / 3600, 0) AS total_coins
|
||||
FROM members
|
||||
LEFT JOIN current_sessions_totals sesh USING (guildid, userid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user