Unverified Commit 6bf86c4f authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

make variable names more meaningful

parent f93d74f8
Pipeline #17933 passed with stages
in 2 minutes
......@@ -274,21 +274,21 @@ class MediametadataToDB:
try:
while True:
consumer.poll()
for recordNo, recordsJson in enumerate(consumer):
for record_number, record_object in enumerate(consumer):
counter += 1
records_json_data = recordsJson.value['@graph']
record_id = _get_record_id(records_json_data)
record = record_object.value['@graph']
record_id = _get_record_id(record)
logging.debug(f'Processing record {record_id}')
access_status = _get_access_status(records_json_data, record_id)
access_status = _get_access_status(record, record_id)
if access_status == 'public' or access_status == 'closed':
for recordJsonData in records_json_data:
for record_resource in record:
enrichable = False
if 'type' in recordJsonData and \
recordJsonData['type'] == 'digitalObject' and \
_has_http_locator(recordJsonData):
if 'type' in record_resource and \
record_resource['type'] == 'digitalObject' and \
_has_http_locator(record_resource):
enrichable = True
enriched_data = \
_try_fetch_from_json_object(recordJsonData,
_try_fetch_from_json_object(record_resource,
_get_values_from_digital_object,
access_status)
if not enriched_data:
......@@ -297,11 +297,11 @@ class MediametadataToDB:
"Could not process digitalObject")
else:
record_values_for_db.append(enriched_data)
if 'type' in recordJsonData and \
recordJsonData['type'] == 'thumbnail':
if 'type' in record_resource and \
record_resource['type'] == 'thumbnail':
enrichable = True
enriched_data = \
_try_fetch_from_json_object(recordJsonData,
_try_fetch_from_json_object(record_resource,
_get_values_from_thumbnail_object,
access_status)
if not enriched_data:
......@@ -321,7 +321,7 @@ class MediametadataToDB:
"IGNORE",
"Ignoring record since access of " +
"digitalObject is unavailable")
if recordNo % 100 == 0:
if record_number % 100 == 0:
_write_values_in_db(mariadb_cursor, record_values_for_db)
mariadb_connection.commit()
for record_value in record_values_for_db:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment