Skip to content

Commit

Permalink
Updated index.yaml and removed 'inactive' property from projection in…
Browse files Browse the repository at this point in the history
… skrafldb.py
  • Loading branch information
vthorsteinsson committed Jan 13, 2021
1 parent 2429c83 commit 2bce5a4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
59 changes: 26 additions & 33 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -132,12 +125,12 @@ indexes:
- name: human_elo
direction: asc
- name: highest_score
- name: inactive
# - name: inactive

- kind: UserModel
properties:
# - name: locale
- name: human_elo
direction: desc
- name: highest_score
- name: inactive
# - name: inactive
7 changes: 4 additions & 3 deletions skrafldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2bce5a4

Please sign in to comment.