current state helper function added
This commit is contained in:
parent
7c1e0c1804
commit
92ce6d89b2
|
@ -3,6 +3,7 @@ from django.db import models, connection
|
||||||
from utils.constants import ALGOS
|
from utils.constants import ALGOS
|
||||||
from evidence.models import SystemProperty, UserProperty, Evidence
|
from evidence.models import SystemProperty, UserProperty, Evidence
|
||||||
from lot.models import DeviceLot
|
from lot.models import DeviceLot
|
||||||
|
from action.models import State
|
||||||
|
|
||||||
|
|
||||||
class Device:
|
class Device:
|
||||||
|
@ -127,6 +128,11 @@ class Device:
|
||||||
def last_uuid(self):
|
def last_uuid(self):
|
||||||
return self.uuids[0]
|
return self.uuids[0]
|
||||||
|
|
||||||
|
def get_current_state(self):
|
||||||
|
uuid = self.last_uuid
|
||||||
|
|
||||||
|
return State.objects.filter(snapshot_uuid=uuid).order_by('-date').first()
|
||||||
|
|
||||||
def get_lots(self):
|
def get_lots(self):
|
||||||
self.lots = [
|
self.lots = [
|
||||||
x.lot for x in DeviceLot.objects.filter(device_id=self.id)]
|
x.lot for x in DeviceLot.objects.filter(device_id=self.id)]
|
||||||
|
|
Loading…
Reference in a new issue