codeant-ai-for-open-source[bot] commented on code in PR #45540:
URL: https://github.com/apache/superset/pull/45540#discussion_r4330044438
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/filterValueGetter.ts:
##########
@@ -19,16 +19,20 @@
*/
import { ValueGetterParams } from
'@superset-ui/core/components/ThemedAgGridReact';
-const filterValueGetter = (params: ValueGetterParams) => {
- const raw = params.data[params.colDef.field as string];
- const formatter = params.colDef.valueFormatter as Function;
- if (!raw || !formatter) return null;
- const formatted = formatter({
- value: raw,
- });
-
- const numeric = parseFloat(String(formatted).replace('%', '').trim());
- return Number.isNaN(numeric) ? null : numeric;
+// Reads the raw value rather than parsing the formatted text back, which
+// carries the locale's separators and SI suffixes. A percent format shows the
+// value scaled by 100, so the filter compares against that scaled number,
+// shifted in decimal notation to avoid binary noise (0.07 * 100).
+const filterValueGetter = (params: ValueGetterParams, percent: boolean) => {
+ const raw = params.data?.[params.colDef.field as string];
Review Comment:
**Suggestion:** For Main comparison columns, `field` has the `Main ` prefix
stripped while row data keeps it, so this lookup returns undefined and
percentage filters treat those values as blank.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Incorrect
variable usage`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=370fbd03ecc64958bb6b00d60595e974&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=370fbd03ecc64958bb6b00d60595e974&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/filterValueGetter.ts
**Line:** 27:27
**Comment:**
*Incorrect Variable Usage: For Main comparison columns, `field` has the
`Main ` prefix stripped while row data keeps it, so this lookup returns
undefined and percentage filters treat those values as blank.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45540&comment_hash=b66fe9fac06f1f196cb08c3ea9e8e05ddeb1e85c26adb1b5f28040ca493795c8&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45540&comment_hash=b66fe9fac06f1f196cb08c3ea9e8e05ddeb1e85c26adb1b5f28040ca493795c8&reaction=dislike'>๐</a>
--
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]