Skip to content

Commit

Permalink
Only return active talents
Browse files Browse the repository at this point in the history
  • Loading branch information
Steeven9 committed Oct 29, 2023
1 parent 61d0cf3 commit a0632e6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ class Tweet(BaseModel):
CLEANER = re.compile('<.*?>')
ACTIVE_TALENTS_LIST: list[Talent] = list(
filter(lambda x: (x["active"]), talents_holo + talents_niji))
ACTIVE_TALENTS_HOLO: list[Talent] = list(
filter(lambda x: (x["active"]), talents_holo))
ACTIVE_TALENTS_NIJI: list[Talent] = list(
filter(lambda x: (x["active"]), talents_niji))
SORTING_PARAM = [("id", ASCENDING)]
EXCLUDE_RTS = True
EXCLUDE_REPLIES = True

ACTIVE_TALENTS_LIST.sort(key=itemgetter("agency", "generationId", "name"))
talents_holo.sort(key=itemgetter("agency", "generationId", "name"))
talents_niji.sort(key=itemgetter("generationId", "name"))
ACTIVE_TALENTS_HOLO.sort(key=itemgetter("agency", "generationId", "name"))
ACTIVE_TALENTS_NIJI.sort(key=itemgetter("generationId", "name"))

if CONNECTION_STRING == None:
raise ValueError("Missing connection string!")
Expand Down Expand Up @@ -193,9 +197,9 @@ def talents() -> list[Talent]:
@app.get("/talents/{server}", summary="List watched talents for a server")
def talents(server: str) -> list[Talent]:
if server.upper() == "KFP":
return talents_holo
return ACTIVE_TALENTS_HOLO
elif server.upper() == "NEST":
return talents_niji
return ACTIVE_TALENTS_NIJI
else:
return []

Expand Down Expand Up @@ -232,9 +236,9 @@ def tweets_server(
newestId: str = None
) -> list[Tweet]:
if server.upper() == "KFP":
talents = talents_holo
talents = ACTIVE_TALENTS_HOLO
elif server.upper() == "NEST":
talents = talents_niji
talents = ACTIVE_TALENTS_NIJI
else:
talents = []

Expand Down

0 comments on commit a0632e6

Please sign in to comment.