adding systemId in metrics csv

This commit is contained in:
Cayo Puigdefabregas 2021-01-20 10:39:02 +01:00
parent 7f6014532d
commit 5ae61d30bc
3 changed files with 8 additions and 4 deletions

View file

@ -335,6 +335,7 @@ class Device(Thing):
if act.type == 'Allocate': if act.type == 'Allocate':
allo = {'type': 'Allocate', allo = {'type': 'Allocate',
'systemId': self.id,
'finalUserCode': act.final_user_code, 'finalUserCode': act.final_user_code,
'numEndUsers': act.end_users, 'numEndUsers': act.end_users,
'hid': self.hid, 'hid': self.hid,
@ -353,6 +354,7 @@ class Device(Thing):
if act.type == 'Deallocate': if act.type == 'Deallocate':
deallo = {'type': 'Deallocate', deallo = {'type': 'Deallocate',
'systemId': self.id,
'finalUserCode': '', 'finalUserCode': '',
'numEndUsers': '', 'numEndUsers': '',
'hid': self.hid, 'hid': self.hid,

View file

@ -368,11 +368,12 @@ class ActionRow(OrderedDict):
def __init__(self, allocate): def __init__(self, allocate):
super().__init__() super().__init__()
# General information about allocates, deallocate and lives # General information about allocates, deallocate and lives
self['SystemId'] = allocate['systemId']
self['Hid'] = allocate['hid'] self['Hid'] = allocate['hid']
self['Start'] = allocate['start'] self['Start'] = allocate['start']
self['finalUserCode'] = allocate['finalUserCode'] self['FinalUserCode'] = allocate['finalUserCode']
self['numEndUsers'] = allocate['numEndUsers'] self['NumEndUsers'] = allocate['numEndUsers']
self['usageTimeAllocate'] = allocate['usageTimeAllocate'] self['UsageTimeAllocate'] = allocate['usageTimeAllocate']
self['Type'] = allocate['type'] self['Type'] = allocate['type']
self['LiveCreate'] = allocate['liveCreate'] self['LiveCreate'] = allocate['liveCreate']
self['usageTimeHdd'] = allocate['usageTimeHdd'] self['UsageTimeHdd'] = allocate['usageTimeHdd']

View file

@ -173,6 +173,7 @@ def test_live_export_csv2(user: UserClient, client: Client, app: Devicehub):
assert "4692" in csv_user assert "4692" in csv_user
assert "8692" in csv_user assert "8692" in csv_user
assert "SystemId" in csv_user
@pytest.mark.mvp @pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__) @pytest.mark.usefixtures(conftest.app_context.__name__)