add/remove item can not depend on timestamp
This commit is contained in:
parent
fb95a1ec55
commit
49763389be
1 changed files with 9 additions and 10 deletions
|
@ -128,12 +128,12 @@ class Changelog(db.Model):
|
||||||
def action_additem(self, user, timestamp, itemid, info):
|
def action_additem(self, user, timestamp, itemid, info):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
i = Item.get(itemid)
|
i = Item.get(itemid)
|
||||||
if i and i.timestamp > timestamp:
|
if i:
|
||||||
if user not in i.users:
|
if user not in i.users:
|
||||||
i.users.append(user)
|
i.users.append(user)
|
||||||
i.update()
|
i.update()
|
||||||
return True
|
return True
|
||||||
if not i:
|
else:
|
||||||
i = Item.get_or_create(itemid, info)
|
i = Item.get_or_create(itemid, info)
|
||||||
i.modified = ts2datetime(timestamp)
|
i.modified = ts2datetime(timestamp)
|
||||||
if user not in i.users:
|
if user not in i.users:
|
||||||
|
@ -173,8 +173,7 @@ class Changelog(db.Model):
|
||||||
def action_removeitem(self, user, timestamp, itemid):
|
def action_removeitem(self, user, timestamp, itemid):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
i = Item.get(itemid)
|
i = Item.get(itemid)
|
||||||
if not i or i.timestamp > timestamp:
|
if i:
|
||||||
return True
|
|
||||||
if user in i.users:
|
if user in i.users:
|
||||||
i.users.remove(user)
|
i.users.remove(user)
|
||||||
if i.users:
|
if i.users:
|
||||||
|
|
Loading…
Reference in a new issue