search bug

This commit is contained in:
Cayo Puigdefabregas 2020-12-28 17:45:21 +01:00
parent b3573f31eb
commit 9ca23a51a2
3 changed files with 5 additions and 2 deletions

View file

@ -1321,6 +1321,7 @@ class Live(JoinedWithOneDeviceMixin, ActionWithOneDevice):
@property
def usage_time_allocate(self):
"""Show how many hours is used one device from the last check"""
import pdb; pdb.set_trace()
self.sort_actions()
if self.usage_time_hdd is None:
return self.last_usage_time_allocate()
@ -1350,7 +1351,6 @@ class Live(JoinedWithOneDeviceMixin, ActionWithOneDevice):
return timedelta(0)
def diff_time(self):
import pdb; pdb.set_trace()
for e in self.actions:
if e.created > self.created:
continue

View file

@ -121,6 +121,7 @@ class LiveView(View):
"""We get the liftime and serial_number of the disk"""
usage_time_hdd = None
serial_number = None
import pdb; pdb.set_trace()
for hd in snapshot['components']:
if not isinstance(hd, DataStorage):
continue
@ -174,6 +175,7 @@ class LiveView(View):
if not device.allocated:
raise ValidationError('Sorry this device is not allocated.')
import pdb; pdb.set_trace()
usage_time_hdd, serial_number = self.get_hdd_details(snapshot, device)
data_live = {'usage_time_hdd': usage_time_hdd,

View file

@ -454,12 +454,13 @@ def test_live_search_last_allocate(user: UserClient, app: Devicehub):
hdd_action['lifetime'] += 1000
acer.pop('elapsed')
acer['licence_version'] = '1.0.0'
import pdb; pdb.set_trace()
live, _ = user.post(acer, res=models.Live)
acer['uuid'] = "490fb8c0-81a1-42e9-95e0-5e7db7038ec4"
actions = [a for a in acer['components'][7]['actions'] if a['type'] != 'TestDataStorage']
acer['components'][7]['actions'] = actions
live, _ = user.post(acer, res=models.Live)
import pdb; pdb.set_trace()
live, _ = user.post(acer, res=models.Live)
assert live['usageTimeAllocate'] == 1000