Skip to content

Commit

Permalink
Merge pull request #82 from licenseware/hist-event
Browse files Browse the repository at this point in the history
fix: history and upload event_data
  • Loading branch information
alincmt authored Mar 16, 2022
2 parents 1ba37de + 109b384 commit 828f87b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions licenseware/history/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ def copy_files_uploaded_on_event_folder(data):

def save_file_content_validation(metadata, response):

file_content_validation = []
for cv in response["event_data"]:
file_content_validation.extend(cv["validation_response"]['validation'])

filepaths = []
for cv in response["event_data"]:
filepaths.extend(cv["filepaths"])

data = {
"tenant_id": metadata["tenant_id"],
"event_id": metadata["event_id"],
"app_id": metadata["app_id"],
"uploader_id": metadata["uploader_id"],
"file_content_validation": response["event_data"]["validation_response"]["validation"],
"files_uploaded": response["event_data"]["filepaths"],
"file_content_validation": file_content_validation,
"files_uploaded": filepaths,
"updated_at": datetime.datetime.utcnow().isoformat()
}

Expand Down
6 changes: 3 additions & 3 deletions licenseware/uploader_builder/uploader_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def upload_files(self, flask_request: Request, event_id: str = None):
}
for filepath in valid_filepaths
]
events_data = [
[
self.worker.send(event) for event in events if validate_event(event, raise_error=False)
]
return {'status': states.SUCCESS, 'message': 'Event sent', 'event_data': events_data}, 200
return {'status': states.SUCCESS, 'message': 'Event sent', 'event_data': events}, 200
else:
event.update({
'filepaths': valid_filepaths,
Expand All @@ -207,7 +207,7 @@ def upload_files(self, flask_request: Request, event_id: str = None):
log.info("Sending event: " + str(event))
self.worker.send(event)

return {'status': states.SUCCESS, 'message': 'Event sent', 'event_data': event}, 200
return {'status': states.SUCCESS, 'message': 'Event sent', 'event_data': [event]}, 200

def init_tenant_quota(self, tenant_id: str, auth_token: str):

Expand Down
Binary file modified wheel_sdk/licenseware-2.0.2-py3-none-any.whl
Binary file not shown.
Binary file modified wheel_sdk/licenseware-2.0.2.tar.gz
Binary file not shown.

0 comments on commit 828f87b

Please sign in to comment.