mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-21 21:17:23 +00:00
switch all to be the default if filter is invalid
This commit is contained in:
parent
44689aad36
commit
e5428dcd4d
@ -69,27 +69,23 @@ def get(status):
|
||||
|
||||
query = None
|
||||
if current_user.gm_level > 0:
|
||||
if status == "all":
|
||||
query = db.session.query().select_from(BugReport)
|
||||
elif status == "resolved":
|
||||
if status == "resolved":
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time != None)
|
||||
elif status == "unresolved":
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time == None)
|
||||
else:
|
||||
raise Exception("Not a valid filter")
|
||||
query = db.session.query().select_from(BugReport)
|
||||
else:
|
||||
chars = CharacterInfo.query.with_entities(CharacterInfo.id).filter(CharacterInfo.account_id == current_user.id).all()
|
||||
char_ids = []
|
||||
for char in chars:
|
||||
char_ids.append(char[0])
|
||||
if status == "all":
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids))
|
||||
elif status == "resolved":
|
||||
if status == "resolved":
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time != None)
|
||||
elif status == "unresolved":
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time == None)
|
||||
else:
|
||||
raise Exception("Not a valid filter")
|
||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids))
|
||||
|
||||
params = request.args.to_dict()
|
||||
|
||||
|
@ -225,14 +225,12 @@ def get(status):
|
||||
]
|
||||
|
||||
query = None
|
||||
if status == "all":
|
||||
query = db.session.query().select_from(CharacterInfo).join(Account)
|
||||
elif status == "approved":
|
||||
if status == "approved":
|
||||
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name == "") & (CharacterInfo.needs_rename == False))
|
||||
elif status == "unapproved":
|
||||
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name != "") | (CharacterInfo.needs_rename == True))
|
||||
else:
|
||||
raise Exception("Not a valid filter")
|
||||
query = db.session.query().select_from(CharacterInfo).join(Account)
|
||||
|
||||
params = request.args.to_dict()
|
||||
|
||||
|
@ -54,14 +54,12 @@ def get_pets(status="all"):
|
||||
]
|
||||
|
||||
query = None
|
||||
if status == "all":
|
||||
query = db.session.query().select_from(PetNames)
|
||||
elif status == "approved":
|
||||
if status == "approved":
|
||||
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 2)
|
||||
elif status == "unapproved":
|
||||
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 1)
|
||||
else:
|
||||
raise Exception("Not a valid filter")
|
||||
query = db.session.query().select_from(PetNames)
|
||||
|
||||
params = request.args.to_dict()
|
||||
|
||||
|
@ -194,9 +194,7 @@ def get(status="all"):
|
||||
]
|
||||
|
||||
query = None
|
||||
if status == "all":
|
||||
query = db.session.query().select_from(Property).join(CharacterInfo, CharacterInfo.id == Property.owner_id).join(Account)
|
||||
elif status == "approved":
|
||||
if status == "approved":
|
||||
query = db.session.query().select_from(Property).join(
|
||||
CharacterInfo, CharacterInfo.id == Property.owner_id
|
||||
).join(Account).filter(Property.mod_approved == True).filter(Property.privacy_option == 2)
|
||||
@ -205,7 +203,7 @@ def get(status="all"):
|
||||
CharacterInfo, CharacterInfo.id == Property.owner_id
|
||||
).join(Account).filter(Property.mod_approved == False).filter(Property.privacy_option == 2)
|
||||
else:
|
||||
raise Exception("Not a valid filter")
|
||||
query = db.session.query().select_from(Property).join(CharacterInfo, CharacterInfo.id == Property.owner_id).join(Account)
|
||||
|
||||
params = request.args.to_dict()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user