small improvements

master
Ruben Bouman 2019-08-15 15:34:31 +02:00
parent 753dd20e54
commit e4eca01168
2 changed files with 5 additions and 11 deletions

View File

@ -117,16 +117,11 @@ def export_data_source_list_to_excel(filename):
if d in my_data_sources.keys(): if d in my_data_sources.keys():
ds = my_data_sources[d] ds = my_data_sources[d]
tmp_date_1 = ds['date_registered'] date_registered = ds['date_registered'].strftime('%Y-%m-%d') if isinstance(ds['date_registered'], datetime) else ds['date_registered']
if isinstance(tmp_date_1, datetime): date_connected = ds['date_connected'].strftime('%Y-%m-%d') if isinstance(ds['date_connected'], datetime) else ds['date_connected']
tmp_date_1 = tmp_date_1.strftime('%Y-%m-%d')
tmp_date_2 = ds['date_connected'] worksheet.write(y, 1, str(date_registered).replace('None', ''), valign_top)
if isinstance(tmp_date_2, datetime): worksheet.write(y, 2, str(date_connected).replace('None', ''), valign_top)
tmp_date_2 = tmp_date_2.strftime('%Y-%m-%d')
worksheet.write(y, 1, str(tmp_date_1).replace('None', ''), valign_top)
worksheet.write(y, 2, str(tmp_date_2).replace('None', ''), valign_top)
worksheet.write(y, 3, ', '.join(ds['products']).replace('None', ''), valign_top) worksheet.write(y, 3, ', '.join(ds['products']).replace('None', ''), valign_top)
worksheet.write(y, 4, ds['comment'][:-1] if ds['comment'].endswith('\n') else ds['comment'], wrap_text) worksheet.write(y, 4, ds['comment'][:-1] if ds['comment'].endswith('\n') else ds['comment'], wrap_text)
worksheet.write(y, 5, str(ds['available_for_data_analytics']), valign_top) worksheet.write(y, 5, str(ds['available_for_data_analytics']), valign_top)
@ -140,7 +135,6 @@ def export_data_source_list_to_excel(filename):
score_count = 0 score_count = 0
for k, v in ds['data_quality'].items(): for k, v in ds['data_quality'].items():
# the below DQ dimensions are given more weight in the calculation of the DQ score. # the below DQ dimensions are given more weight in the calculation of the DQ score.
print(k)
if k in ['device_completeness', 'data_field_completeness', 'retention']: if k in ['device_completeness', 'data_field_completeness', 'retention']:
score += (v * 2) score += (v * 2)
score_count += 2 score_count += 2

View File

@ -94,7 +94,7 @@ def _select_file(title, what, expected_file_type, b_clear=True):
:param title: title to print on top of this menu :param title: title to print on top of this menu
:param what: print for what purpose the file is selected :param what: print for what purpose the file is selected
:param expected_file_type: the expected file type of the YAML file :param expected_file_type: the expected file type of the YAML file
:param b_clear: _clear the terminal before showing this menu :param b_clear: clear the terminal before showing this menu
:return: filename of the selected file :return: filename of the selected file
""" """
global yaml_path global yaml_path