From 2bce5a4237f70c6f32521d57adbc9ab7e339030b Mon Sep 17 00:00:00 2001 From: Vilhjalmur Thorsteinsson Date: Wed, 13 Jan 2021 17:17:29 +0000 Subject: [PATCH] Updated index.yaml and removed 'inactive' property from projection in skrafldb.py --- index.yaml | 59 +++++++++++++++++++++++------------------------------ skrafldb.py | 7 ++++--- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/index.yaml b/index.yaml index d71e91e9..94435eab 100755 --- a/index.yaml +++ b/index.yaml @@ -20,37 +20,6 @@ indexes: properties: - name: timestamp -- kind: ChannelModel - properties: - - name: connected - - name: entity - - name: kind - - name: user - - name: expiry - -- kind: ChannelModel - properties: - - name: connected - - name: expiry - -- kind: ChannelModel - properties: - - name: connected - - name: expiry - - name: user - -- kind: ChannelModel - properties: - - name: connected - - name: user - - name: expiry - -- kind: ChannelModel - properties: - - name: entity - - name: kind - - name: expiry - - kind: ChatModel properties: - name: channel @@ -112,6 +81,30 @@ indexes: - kind: StatsModel properties: - name: robot_level + - name: timestamp + direction: desc + +- kind: StatsModel + properties: + - name: robot_level + - name: user + - name: timestamp + direction: desc + +- kind: StatsModel + properties: + - name: timestamp + - name: elo + direction: desc + +- kind: StatsModel + properties: + - name: timestamp + - name: human_elo + direction: desc + +- kind: StatsModel + properties: - name: user - name: timestamp direction: desc @@ -132,7 +125,7 @@ indexes: - name: human_elo direction: asc - name: highest_score - - name: inactive +# - name: inactive - kind: UserModel properties: @@ -140,4 +133,4 @@ indexes: - name: human_elo direction: desc - name: highest_score - - name: inactive +# - name: inactive diff --git a/skrafldb.py b/skrafldb.py index 274fbeff..0196bbe7 100755 --- a/skrafldb.py +++ b/skrafldb.py @@ -377,10 +377,11 @@ def fetch(q: ndb.Query, max_len: int) -> Iterator[str]: # pylint: disable=bad-continuation counter = 0 # Number of results already returned for k in iter_q( - q, chunk_size=max_len, projection=["highest_score", "inactive"] + q, chunk_size=max_len, projection=["highest_score"] ): - if k.highest_score > 0 and not k.inactive: - # Is active and has played at least one game: Yield the key value + if k.highest_score > 0: + # Has played at least one game: Yield the key value + # Note that inactive users will be filtered out at a later stage yield k.key.id() counter += 1 if counter >= max_len: