Add debug prints

This commit is contained in:
Madis Mägi 2023-08-02 01:34:20 +03:00
parent d3a4ddd314
commit 3d7025ee4b

View File

@ -41,10 +41,13 @@ def view_users():
@check_api_key @check_api_key
def get_group_cards(): def get_group_cards():
groups = request.json.get("groups", False) groups = request.json.get("groups", False)
users = get_users()
print(groups)
print(users)
if not groups: if not groups:
return "must specify groups in parameter", 400 return "must specify groups in parameter", 400
print(groups) gu = list(filter(lambda u: any(g["name"] in groups for g in u["status"]["groups"]), users))
gu = list(filter(lambda u: any(g["name"] in groups for g in u["status"]["groups"]), get_users())) print(gu)
keys = list(map(lambda u: u["metadata"]["name"], gu)) keys = list(map(lambda u: u["metadata"]["name"], gu))
print(keys) print(keys)
flt = { flt = {
@ -61,5 +64,7 @@ def get_group_cards():
if obj["inventory"] and obj["inventory"]["owner"] and type(obj["inventory"]["owner"]["foreign_id"]) != str: if obj["inventory"] and obj["inventory"]["owner"] and type(obj["inventory"]["owner"]["foreign_id"]) != str:
del obj["inventory"] del obj["inventory"]
found.append(obj) found.append(obj)
return jsonify(list(found)) fl = list(found)
print(fl)
return jsonify(fl)