Handle user not in lookup table
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
parent
8b9ac4b92b
commit
a637c2d2a1
@ -90,7 +90,7 @@ def build_query(base_query, fields=[], sort_fields={}):
|
|||||||
val = request.args.get(key, type=tp)
|
val = request.args.get(key, type=tp)
|
||||||
results = db.inventory.find(base_query).distinct(attr)
|
results = db.inventory.find(base_query).distinct(attr)
|
||||||
if key in ("inventory_owner_username", "inventory_user_username"):
|
if key in ("inventory_owner_username", "inventory_user_username"):
|
||||||
results = [{"username": u, "display_name": users_lookup[u]["spec"]["customProfile"]["name"]} for u in results]
|
results = [{"username": u, "display_name": users_lookup.get(u, {}).get("spec", {}).get("customProfile", {}).get("name", u)} for u in results]
|
||||||
results = sorted(results, key = lambda k: k["display_name"])
|
results = sorted(results, key = lambda k: k["display_name"])
|
||||||
elif tp != list:
|
elif tp != list:
|
||||||
results = sorted(results)
|
results = sorted(results)
|
||||||
|
Loading…
Reference in New Issue
Block a user