add new filter in actions for show only active snapshots

This commit is contained in:
Cayo Puigdefabregas 2022-12-22 18:39:59 +01:00
parent bf5c3d6abc
commit 14ce3892ac

View file

@ -264,16 +264,18 @@ class Device(Thing):
""" """
actions_multiple = copy.copy(self.actions_multiple) actions_multiple = copy.copy(self.actions_multiple)
actions_one = copy.copy(self.actions_one) actions_one = copy.copy(self.actions_one)
actions = []
for ac in actions_multiple: for ac in actions_multiple:
ac.real_created = ac.actions_device[0].created ac.real_created = ac.actions_device[0].created
actions.append(ac)
for ac in actions_one: for ac in actions_one:
ac.real_created = ac.created ac.real_created = ac.created
if ac.type != 'Snapshot' or ac.active:
actions.append(ac)
return sorted( return sorted(actions, key=lambda x: x.real_created)
chain(actions_multiple, actions_one), key=lambda x: x.real_created
)
@property @property
def problems(self): def problems(self):