(decoded, filename, app_uuid, fix, file_fixed, file_failed, display_queue)
return file_fixed, file_failed
Recursively check the decoded dashboard object for widget references and validate the app_id inside.
Recursively check the decoded dashboard object for widget references and validate the app_id inside.
Recursively check the decoded dashboard object for widget references and validate the app_id inside .
def check_widgets(decoded, filename, app_uuid, fix, file_fixed, file_failed, display_queue):
    """Recursively check the decoded dashboard object for widget references and validate the app_id inside."""
    for widget in decoded.get('widgets', []):

        if widget.get('definition', {}).get('widgets'):
            decoded = {'widgets': widget['definition']['widgets']}
            file_fixed, file_failed = check_widgets(
                decoded, filename, app_uuid, fix, file_fixed, file_failed, display_queue
            )

        widget_app_uuid = widget.get('definition', {}).get('app_id')
        if widget_app_uuid and widget_app_uuid != app_uuid:
            if fix:
                widget['definition']['app_id'] = app_uuid
                file_fixed = True
                continue
            else:
                file_failed = True
                msg = (
                    f"    {filename} widget {widget['id']} does not contain correct app_uuid: "
                    f"{widget_app_uuid} should be {app_uuid}"
                )
                display_queue.append(
                    (echo_failure, msg),
                )
    return file_fixed, file_failed
def check_widgets ( decoded , filename , app_uuid , fix , file_fixed , file_failed , display_queue ) : for widget in decoded . get ( 'widgets' , [ ] ) : if widget . get ( 'definition' , { } ) . get ( 'widgets' ) : decoded = { 'widgets' : widget [ 'definition' ] [ 'widgets' ] } file_fixed , file_failed = check_widgets ( decoded , filename , app_uuid , fix , file_fixed , file_failed , display_queue ) widget_app_uuid = widget . get ( 'definition' , { } ) . get ( 'app_id' ) if widget_app_uuid and widget_app_uuid != app_uuid : if fix : widget [ 'definition' ] [ 'app_id' ] = app_uuid file_fixed = True continue else : file_failed = True msg = ( f"    {filename} widget {widget['id']} does not contain correct app_uuid: " f"{widget_app_uuid} should be {app_uuid}" ) display_queue . append ( ( echo_failure , msg ) , ) return file_fixed , file_failed