bito-code-review[bot] commented on PR #43567:
URL: https://github.com/apache/superset/pull/43567#issuecomment-5438283319
<!-- Bito Reply -->
The issue is valid. The `map_funnel_config` function in
`superset/mcp_service/chart/chart_utils.py` currently only passes
`sort_by_metric` as a flag in `form_data`, but it does not translate this into
the `orderby` clause required by the Superset backend to actually perform the
sorting. To resolve this, you should update `map_funnel_config` to include the
`orderby` clause when `sort_by_metric` is true.
Here is the suggested fix for `superset/mcp_service/chart/chart_utils.py`:
```python
form_data: Dict[str, Any] = {
"viz_type": "funnel",
"groupby": [config.dimension.name],
"metric": create_metric_object(config.metric),
"sort_by_metric": config.sort_by_metric,
"row_limit": config.row_limit,
"color_scheme": config.color_scheme or "supersetColors",
}
if config.sort_by_metric:
form_data["orderby"] = [[create_metric_object(config.metric), False]]
_add_adhoc_filters(form_data, config.filters)
```
Would you like me to check the other comments on this PR and implement fixes
for them as well?
**superset/mcp_service/chart/chart_utils.py**
```
if config.sort_by_metric:
form_data["orderby"] = [[create_metric_object(config.metric), False]]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]