Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explore): Incorrect conversion from simple bool filter to custom sql #21293

Merged
merged 2 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions superset-frontend/src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export function optionLabel(opt) {
return EMPTY_STRING;
}
if (opt === true) {
return '<true>';
return 'true';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the TRUE_STRING and FALSE_STRING constants?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Though now we'll have TRUE instead of true in the labels

}
if (opt === false) {
return '<false>';
return 'false';
}
if (typeof opt !== 'string' && opt.toString) {
return opt.toString();
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/utils/common.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe('utils/common', () => {
it('converts values as expected', () => {
expect(optionFromValue(false)).toEqual({
value: false,
label: '<false>',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the constants here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

label: 'false',
});
expect(optionFromValue(true)).toEqual({ value: true, label: '<true>' });
expect(optionFromValue(true)).toEqual({ value: true, label: 'true' });
expect(optionFromValue(null)).toEqual({
value: NULL_STRING,
label: NULL_STRING,
Expand Down