only add items to list once they are available
This commit is contained in:
parent
10e651067c
commit
83ceb5b63f
3 changed files with 25 additions and 18 deletions
|
|
@ -98,9 +98,9 @@ class Peer(object):
|
|||
elif action == 'editlist':
|
||||
name, new = args
|
||||
if name in self.info['lists']:
|
||||
self.info['lists'][new] = self.info['lists'].pop(name)
|
||||
self.info['lists'][new['name']] = self.info['lists'].pop(name)
|
||||
else:
|
||||
self.info['lists'][new] = []
|
||||
self.info['lists'][new['name']] = []
|
||||
elif action == 'orderlists':
|
||||
self.info['listorder'] = args[0]
|
||||
elif action == 'removelist':
|
||||
|
|
@ -183,15 +183,6 @@ class Peer(object):
|
|||
os.unlink(self._infopath)
|
||||
|
||||
def sync_db(self):
|
||||
ids = set(self.library.keys())
|
||||
changed = False
|
||||
for name, l in self.info.get('lists', {}).items():
|
||||
removed = set(l) - ids
|
||||
if removed:
|
||||
self.info['lists'][name] = list(set(l) - removed)
|
||||
changed = True
|
||||
if changed:
|
||||
self.sync_info()
|
||||
import item.models
|
||||
import user.models
|
||||
c_user_id = item.models.user_items.columns['user_id']
|
||||
|
|
@ -303,6 +294,15 @@ class Peer(object):
|
|||
if state.shutdown:
|
||||
break
|
||||
state.db.session.commit()
|
||||
ids = set(self.library.keys())
|
||||
changed = False
|
||||
for name, l in self.info.get('lists', {}).items():
|
||||
removed = set(l) - ids
|
||||
if removed:
|
||||
self.info['lists'][name] = list(set(l) - removed)
|
||||
changed = True
|
||||
if changed:
|
||||
self.sync_info()
|
||||
|
||||
def sync_db():
|
||||
from sqlalchemy.orm import load_only
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue