parent
72ff5aea12
commit
385831d735
4 changed files with 18 additions and 12 deletions
|
@ -63,14 +63,12 @@ class IssueSerializer(BasicIssueSerializer):
|
|||
@staticmethod
|
||||
def get_last_activity(self):
|
||||
try:
|
||||
last_state_change = self.state_changes.order_by('-timestamp').first().timestamp \
|
||||
if self.state_changes.count() > 0 else None
|
||||
last_comment = self.comments.order_by('-timestamp').first().timestamp if self.comments.count() > 0 else None
|
||||
last_mail = self.emails.order_by('-timestamp').first().timestamp if self.emails.count() > 0 else None
|
||||
last_assignment = self.assignments.order_by('-timestamp').first().timestamp if \
|
||||
self.assignments.count() > 0 else None
|
||||
last_relation = self.item_relation_changes.order_by('-timestamp').first().timestamp if \
|
||||
self.item_relation_changes.count() > 0 else None
|
||||
last_state_change = max([t.timestamp for t in self.state_changes.all()]) if self.state_changes.exists() else None
|
||||
last_comment = max([t.timestamp for t in self.comments.all()]) if self.comments.exists() else None
|
||||
last_mail = max([t.timestamp for t in self.emails.all()]) if self.emails.exists() else None
|
||||
last_assignment = max([t.timestamp for t in self.assignments.all()]) if self.assignments.exists() else None
|
||||
|
||||
last_relation = max([t.timestamp for t in self.item_relation_changes.all()]) if self.item_relation_changes.exists() else None
|
||||
args = [x for x in [last_state_change, last_comment, last_mail, last_assignment, last_relation] if
|
||||
x is not None]
|
||||
return max(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue