dont fail without nodes
This commit is contained in:
parent
55ba49b631
commit
8aef4a62ef
1 changed files with 7 additions and 6 deletions
|
@ -87,12 +87,13 @@ def getUsers(data):
|
||||||
for u in models.User.query.filter(models.User.id!=settings.USER_ID).all():
|
for u in models.User.query.filter(models.User.id!=settings.USER_ID).all():
|
||||||
users.append(u.json())
|
users.append(u.json())
|
||||||
ids.add(u.id)
|
ids.add(u.id)
|
||||||
for id in state.nodes._local._nodes:
|
if state.nodes:
|
||||||
if id not in ids:
|
for id in state.nodes._local._nodes:
|
||||||
n = state.nodes._local._nodes[id].copy()
|
if id not in ids:
|
||||||
n['online'] = True
|
n = state.nodes._local._nodes[id].copy()
|
||||||
n['name'] = n['username']
|
n['online'] = True
|
||||||
users.append(n)
|
n['name'] = n['username']
|
||||||
|
users.append(n)
|
||||||
users.sort(key=lambda u: ox.sort_string(str(u.get('index', '')) + 'Z' + (u.get('name') or '')))
|
users.sort(key=lambda u: ox.sort_string(str(u.get('index', '')) + 'Z' + (u.get('name') or '')))
|
||||||
return {
|
return {
|
||||||
"users": users
|
"users": users
|
||||||
|
|
Loading…
Reference in a new issue