1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 22:44:19 +00:00

🧹 Cleanup filter conditions

This commit is contained in:
Stefano Pigozzi 2021-04-30 15:46:53 +02:00
parent 28979d7f8a
commit 400909feb8
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01

View file

@ -20,10 +20,10 @@ def page_repositories():
spectator = Authorization.query.filter_by(email=user.email).join(Repository) spectator = Authorization.query.filter_by(email=user.email).join(Repository)
if request.json.get("onlyActive"): if request.json.get("onlyActive"):
owner = owner.filter_by(isActive=True) owner = owner.filter_by(isActive=True)
spectator = spectator.filter(Repository.isActive == True) spectator = spectator.filter(Repository.isActive)
elif request.json.get("onlyDead"): elif request.json.get("onlyDead"):
owner = owner.filter_by(isActive=False) owner = owner.filter_by(isActive=False)
spectator = spectator.filter(Repository.isActive == False) spectator = spectator.filter(not Repository.isActive)
owner = owner.all() owner = owner.all()
spectator = spectator.all() spectator = spectator.all()
return json_success({"owner": [r.to_json() for r in owner], return json_success({"owner": [r.to_json() for r in owner],