fixing model

This commit is contained in:
Cayo Puigdefabregas 2021-04-27 13:54:13 +02:00
parent 330f2b7b78
commit c1081994de
1 changed files with 8 additions and 5 deletions

View File

@ -1461,7 +1461,9 @@ class Confirm(JoinedTableMixin, ActionWithMultipleDevices):
action = db.relationship('Action', action = db.relationship('Action',
backref=backref('acceptances', backref=backref('acceptances',
uselist=True, uselist=True,
lazy=True), lazy=True,
order_by=lambda: Action.end_time,
collection_class=list),
primaryjoin='Confirm.action_id == Action.id') primaryjoin='Confirm.action_id == Action.id')
def __repr__(self) -> str: def __repr__(self) -> str:
@ -1469,9 +1471,10 @@ class Confirm(JoinedTableMixin, ActionWithMultipleDevices):
origin = 'To' origin = 'To'
if self.user == self.action.user_from: if self.user == self.action.user_from:
origin = 'From' origin = 'From'
if self.revoke:
self.t = 'Revoke'
self.type = 'Revoke'
return '<{0.t} {0.id} accepted by {1}>'.format(self, origin) return '<{0.t} {0.id} accepted by {1}>'.format(self, origin)
if self.action == 'Confirm':
return '<{0.t} {0.id} Revoke Confirm {0.action.id}>'.format(self)
class Trade(JoinedTableMixin, ActionWithMultipleDevices): class Trade(JoinedTableMixin, ActionWithMultipleDevices):