Merge pull request #353 from eReuse/bugfix/2656-update-in-list

get the last update of one device
This commit is contained in:
cayop 2022-09-20 17:52:17 +02:00 committed by GitHub
commit 26a803d1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -629,6 +629,14 @@ class Device(Thing):
return self.binding.device.devicehub_id
return self.devicehub_id
@property
def get_updated(self):
if self.placeholder and self.placeholder.binding:
return max([self.updated, self.placeholder.binding.updated])
if self.binding:
return max([self.updated, self.binding.device.updated])
return self.updated
@declared_attr
def __mapper_args__(cls):
"""Defines inheritance.

View File

@ -437,7 +437,7 @@
<td>{% if dev.status %}{{ dev.status.type }}{% endif %}</td>
<td>{% if dev.allocated_status %}{{ dev.allocated_status.type }}{% endif %}</td>
<td>{% if dev.physical_status %}{{ dev.physical_status.type }}{% endif %}</td>
<td>{{ dev.updated.strftime('%Y-%m-%d %H:%M:%S')}}</td>
<td>{{ dev.get_updated.strftime('%Y-%m-%d %H:%M:%S')}}</td>
<td>{{ dev.created.strftime('%Y-%m-%d %H:%M:%S')}}</td>
<td>
<a href="{{ dev.public_link }}" target="_blank">