fix sync_metadata peer sort

This commit is contained in:
j 2016-01-24 13:03:03 +05:30
parent 4d9d54ad8f
commit 168b293514

View file

@ -325,8 +325,11 @@ class Item(db.Model):
if self.meta.get('sharemetadata'):
return
peers = [u for u in self.users if u.id != settings.USER_ID]
peers.sort(key=lambda u: ox.sort_string(str(u.info.get('index', ''))
+ 'Z' + (u.info.get('name') or '')))
def peer_sort(u):
info = u.json()
return ox.sort_string(str(info.get('index', ''))
+ 'Z' + (info.get('name') or ''))
peers.sort(key=peer_sort)
sync_from = None
first_peer = None
# get first peer with sharemetadata set