mirror of
https://github.com/norohind/SquadsActivityMonitor.git
synced 2025-04-15 06:10:33 +03:00
pretty keys names in api response
This commit is contained in:
parent
56bd4f335b
commit
181f7892de
2
model.py
2
model.py
@ -14,7 +14,7 @@ db.row_factory = lambda c, r: dict(zip([col[0] for col in c.description], r))
|
|||||||
|
|
||||||
|
|
||||||
def get_activity_changes(platform: str, leaderboard_type: str, limit: int, low_timestamp, high_timestamp) -> list:
|
def get_activity_changes(platform: str, leaderboard_type: str, limit: int, low_timestamp, high_timestamp) -> list:
|
||||||
sql_req: sqlite3.Cursor = db.execute(sql_requests.select_activity, {
|
sql_req: sqlite3.Cursor = db.execute(sql_requests.select_activity_pretty_names, {
|
||||||
'LB_type': utils.LeaderboardTypes(leaderboard_type.lower()).value,
|
'LB_type': utils.LeaderboardTypes(leaderboard_type.lower()).value,
|
||||||
'platform': utils.Platform(platform.upper()).value,
|
'platform': utils.Platform(platform.upper()).value,
|
||||||
'limit': limit,
|
'limit': limit,
|
||||||
|
@ -56,3 +56,25 @@ from (
|
|||||||
group by sum_score
|
group by sum_score
|
||||||
order by timestamp desc
|
order by timestamp desc
|
||||||
limit :limit);"""
|
limit :limit);"""
|
||||||
|
|
||||||
|
select_activity_pretty_names = """select
|
||||||
|
sum_score as TotalExperience,
|
||||||
|
timestamp as Timestamp,
|
||||||
|
action_id as ActionId,
|
||||||
|
sum_score_old as TotalExperienceOld,
|
||||||
|
sum_score - sum_score_old as Diff
|
||||||
|
from
|
||||||
|
(select sum_score, min(timestamp) as timestamp, action_id, lag (sum_score, 1, 0) over (order by sum_score) sum_score_old
|
||||||
|
from (
|
||||||
|
select sum(score) as sum_score, timestamp, action_id
|
||||||
|
from squads_stats_states
|
||||||
|
where
|
||||||
|
leaderboard_type = :LB_type and
|
||||||
|
platform = :platform and
|
||||||
|
:high_timestamp >= timestamp and
|
||||||
|
timestamp >= :low_timestamp
|
||||||
|
group by action_id
|
||||||
|
)
|
||||||
|
group by sum_score
|
||||||
|
order by timestamp desc
|
||||||
|
limit :limit);"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user