Merge pull request #108 from eReuse/change/change-rows

adding systemId in metrics csv
This commit is contained in:
cayop 2021-01-20 10:47:18 +01:00 committed by GitHub
commit 838b6b26a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

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

View File

@ -368,11 +368,12 @@ class ActionRow(OrderedDict):
def __init__(self, allocate):
super().__init__()
# General information about allocates, deallocate and lives
self['SystemId'] = allocate['systemId']
self['Hid'] = allocate['hid']
self['Start'] = allocate['start']
self['finalUserCode'] = allocate['finalUserCode']
self['numEndUsers'] = allocate['numEndUsers']
self['usageTimeAllocate'] = allocate['usageTimeAllocate']
self['FinalUserCode'] = allocate['finalUserCode']
self['NumEndUsers'] = allocate['numEndUsers']
self['UsageTimeAllocate'] = allocate['usageTimeAllocate']
self['Type'] = allocate['type']
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 "8692" in csv_user
assert "SystemId" in csv_user
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)