diff --git a/scripts/build_message_web.py b/scripts/build_message_web.py index 357b2490e..99e7c379f 100644 --- a/scripts/build_message_web.py +++ b/scripts/build_message_web.py @@ -34,6 +34,9 @@ def fetch_current_indexed_sdk_files(es : Elasticsearch, index_name): if False == eachHit['_source']['hidden']: all_packages.append(eachHit['_source']) + # Sort all_packages alphabetically by the 'name' field + all_packages.sort(key=lambda x: x['name']) + return all_packages def fetch_current_indexed_click_boards(es : Elasticsearch, index_name): @@ -109,6 +112,9 @@ def fetch_current_indexed_click_boards(es : Elasticsearch, index_name): data = json.load(file) release_spreadsheet_data = '' + board_lines = '' + mcu_lines = '' + card_lines = '' update_present = 0 todays_release = '

New:

\n\n' todays_update = '\n\n

Updated:

\n\n' @@ -122,7 +128,7 @@ def fetch_current_indexed_click_boards(es : Elasticsearch, index_name): # Find newly published clicks if 'published' in each_click: if each_click['published'].startswith(current_date): - todays_release = todays_release.replace('', f'\t
  • {each_click['display_name']}
  • \n') + todays_release = todays_release.replace('', f'\t
  • Driver for {each_click['display_name'].replace('click', 'Click')}
  • \n') # TODO - when info regarding update tracing is provided - update accordingly # if each_click['last_updated'].startswith(current_date): # todays_update = todays_update.replace('', f'\t
  • {each_click['display_name']}
  • \n') @@ -137,12 +143,42 @@ def fetch_current_indexed_click_boards(es : Elasticsearch, index_name): if sdk_file['published_at'].startswith(current_date): # Check if it is a newly released package that is listed in release spreadsheet if sdk_file['display_name'] in release_spreadsheet_data: - todays_release = todays_release.replace('', f'\t
  • {sdk_file['display_name']}
  • \n') + if sdk_file['type'] == 'mcu': + # Separate MCU packages to display them before boards and cards of the list + mcu_lines += f'\t
  • {sdk_file['display_name']}
  • \n' + elif sdk_file['type'] == 'card': + # Separate card packages to display them before boards + card_lines += f'\t
  • Card Package for {sdk_file['display_name']}
  • \n' + elif sdk_file['type'] == 'board': + # Separate boards to display them at the end of the list + board_lines += f'\t
  • Board Package for {sdk_file['display_name']}
  • \n' + else: + # If it is not boards/cards/MCUs - add it to the release list + todays_release = todays_release.replace('', f'\t
  • {sdk_file['display_name']}
  • \n') # If it is not newly released package - add it to UPDATED section else: - todays_update = todays_update.replace('', f'\t
  • {sdk_file['display_name']}
  • \n') + if sdk_file['type'] == 'card': + todays_update = todays_update.replace('', f'\t
  • Card Package for {sdk_file['display_name']}
  • \n') + elif sdk_file['type'] == 'board': + todays_update = todays_update.replace('', f'\t
  • Board Package for {sdk_file['display_name']}
  • \n') + else: + todays_update = todays_update.replace('', f'\t
  • {sdk_file['display_name']}
  • \n') update_present = 1 + # Workaround to display mikroSDK as updated package although it is in the spreadsheet + if 'mikroSDK' in todays_release: + todays_release = todays_release.replace('\t
  • mikroSDK
  • \n', '') + todays_update = todays_update.replace('') + # Add cards before boards + todays_release = todays_release.replace('', f'{card_lines}') + # Add boards to the end of the todays_release list + todays_release = todays_release.replace('', f'{board_lines}') + + # If there were any updates today - add them if update_present: todays_release += todays_update