Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Updated README, and comments within exporter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Oreglia committed Jun 29, 2017
1 parent 44e75de commit b149e36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tools/exporter/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Allows you to export audit data from the SafetyCulture Platform and save them anywhere on your computer.

Supported export formats: PDF, MS WORD (docx), JSON, and CSV. Media exporting are also supported.
Supported export formats: PDF, MS WORD (docx), JSON, and CSV. Media exporting is also supported.

## Installation

Expand Down Expand Up @@ -65,7 +65,7 @@ python csvExporter.py path/to/audit_file.json
* Audits are grouped by Template. Audits built from the same template are appended to a CSV file named using the templates unique ID number.

To export Multiple Audits to Bulk CSV file:
* Execute Exporter.py with the format option set to CSV
* Execute exporter.py with the format option set to CSV
```
python exporter.py --format csv
```
Expand Down
6 changes: 3 additions & 3 deletions tools/exporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,14 @@ def get_media_from_audit(logger, audit_json):
"""
media_id_list = []
for item in audit_json['header_items'] + audit_json['items']:
# media field, question field. List of media
# This condition checks for media attached to question and media type fields.
if 'media' in item.keys():
for media in item['media']:
media_id_list.append(media['media_id'])
# Signature field, drawing field. Object, single media
# This condition checks for media attached to signature and drawing type fields.
if 'responses' in item.keys() and 'image' in item['responses'].keys():
media_id_list.append(item['responses']['image']['media_id'])
# Information field. Object, single media.
# This condition checks for media attached to information type fields.
if 'options' in item.keys() and 'media' in item['options'].keys():
media_id_list.append(item['options']['media']['media_id'])
logger.info("Discovered {0} media files associated with {1}.".format(len(media_id_list), audit_json['audit_id']))
Expand Down

0 comments on commit b149e36

Please sign in to comment.