mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-09 19:58:19 +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
|
query = None
|
||||||
if current_user.gm_level > 0:
|
if current_user.gm_level > 0:
|
||||||
if status == "all":
|
if status == "resolved":
|
||||||
query = db.session.query().select_from(BugReport)
|
|
||||||
elif status == "resolved":
|
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time != None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time != None)
|
||||||
elif status == "unresolved":
|
elif status == "unresolved":
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time == None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.resolved_time == None)
|
||||||
else:
|
else:
|
||||||
raise Exception("Not a valid filter")
|
query = db.session.query().select_from(BugReport)
|
||||||
else:
|
else:
|
||||||
chars = CharacterInfo.query.with_entities(CharacterInfo.id).filter(CharacterInfo.account_id == current_user.id).all()
|
chars = CharacterInfo.query.with_entities(CharacterInfo.id).filter(CharacterInfo.account_id == current_user.id).all()
|
||||||
char_ids = []
|
char_ids = []
|
||||||
for char in chars:
|
for char in chars:
|
||||||
char_ids.append(char[0])
|
char_ids.append(char[0])
|
||||||
if status == "all":
|
if status == "resolved":
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids))
|
|
||||||
elif status == "resolved":
|
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time != None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time != None)
|
||||||
elif status == "unresolved":
|
elif status == "unresolved":
|
||||||
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time == None)
|
query = db.session.query().select_from(BugReport).filter(BugReport.reporter_id.in_(char_ids)).filter(BugReport.resolved_time == None)
|
||||||
else:
|
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()
|
params = request.args.to_dict()
|
||||||
|
|
||||||
|
@ -225,14 +225,12 @@ def get(status):
|
|||||||
]
|
]
|
||||||
|
|
||||||
query = None
|
query = None
|
||||||
if status == "all":
|
if status == "approved":
|
||||||
query = db.session.query().select_from(CharacterInfo).join(Account)
|
|
||||||
elif status == "approved":
|
|
||||||
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name == "") & (CharacterInfo.needs_rename == False))
|
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name == "") & (CharacterInfo.needs_rename == False))
|
||||||
elif status == "unapproved":
|
elif status == "unapproved":
|
||||||
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name != "") | (CharacterInfo.needs_rename == True))
|
query = db.session.query().select_from(CharacterInfo).join(Account).filter((CharacterInfo.pending_name != "") | (CharacterInfo.needs_rename == True))
|
||||||
else:
|
else:
|
||||||
raise Exception("Not a valid filter")
|
query = db.session.query().select_from(CharacterInfo).join(Account)
|
||||||
|
|
||||||
params = request.args.to_dict()
|
params = request.args.to_dict()
|
||||||
|
|
||||||
|
@ -54,14 +54,12 @@ def get_pets(status="all"):
|
|||||||
]
|
]
|
||||||
|
|
||||||
query = None
|
query = None
|
||||||
if status == "all":
|
if status == "approved":
|
||||||
query = db.session.query().select_from(PetNames)
|
|
||||||
elif status == "approved":
|
|
||||||
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 2)
|
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 2)
|
||||||
elif status == "unapproved":
|
elif status == "unapproved":
|
||||||
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 1)
|
query = db.session.query().select_from(PetNames).filter(PetNames.approved == 1)
|
||||||
else:
|
else:
|
||||||
raise Exception("Not a valid filter")
|
query = db.session.query().select_from(PetNames)
|
||||||
|
|
||||||
params = request.args.to_dict()
|
params = request.args.to_dict()
|
||||||
|
|
||||||
|
@ -194,9 +194,7 @@ def get(status="all"):
|
|||||||
]
|
]
|
||||||
|
|
||||||
query = None
|
query = None
|
||||||
if status == "all":
|
if status == "approved":
|
||||||
query = db.session.query().select_from(Property).join(CharacterInfo, CharacterInfo.id == Property.owner_id).join(Account)
|
|
||||||
elif status == "approved":
|
|
||||||
query = db.session.query().select_from(Property).join(
|
query = db.session.query().select_from(Property).join(
|
||||||
CharacterInfo, CharacterInfo.id == Property.owner_id
|
CharacterInfo, CharacterInfo.id == Property.owner_id
|
||||||
).join(Account).filter(Property.mod_approved == True).filter(Property.privacy_option == 2)
|
).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
|
CharacterInfo, CharacterInfo.id == Property.owner_id
|
||||||
).join(Account).filter(Property.mod_approved == False).filter(Property.privacy_option == 2)
|
).join(Account).filter(Property.mod_approved == False).filter(Property.privacy_option == 2)
|
||||||
else:
|
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()
|
params = request.args.to_dict()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user