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(discover): Pick the correct y-axis for unfurls #29488

Merged
merged 7 commits into from
Oct 22, 2021

Conversation

shruthilayaj
Copy link
Member

We have some Discover Saved queries that don't have
yAxis saved on the Database. To avoid yAxis mix ups
when these links are shared, we just want to mimic
how Discover displays yAxis - picking the first option
when yAxis isn't explicitly specified.

@shruthilayaj shruthilayaj requested review from a team and removed request for a team October 21, 2021 17:38
@shruthilayaj shruthilayaj changed the title fix(discover): pick the correct y-axis for unfurls fix(discover): Pick the correct y-axis for unfurls Oct 21, 2021
Comment on lines 51 to 57
def is_aggregate(field: str) -> bool:
field_match = re.match(AGGREGATE_PATTERN, field)
equation_match = re.match(AGGREGATE_BASE, field) and is_equation(field)
if field_match or equation_match:
return True

return False
Copy link
Member

Choose a reason for hiding this comment

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

nit:
could either do
faster but messy

Suggested change
def is_aggregate(field: str) -> bool:
field_match = re.match(AGGREGATE_PATTERN, field)
equation_match = re.match(AGGREGATE_BASE, field) and is_equation(field)
if field_match or equation_match:
return True
return False
def is_aggregate(field: str) -> bool:
field_match = re.match(AGGREGATE_PATTERN, field)
if field_match:
return True
equation_match = re.match(AGGREGATE_BASE, field) and is_equation(field)
if equation_match:
return True
return False

cleaner:

Suggested change
def is_aggregate(field: str) -> bool:
field_match = re.match(AGGREGATE_PATTERN, field)
equation_match = re.match(AGGREGATE_BASE, field) and is_equation(field)
if field_match or equation_match:
return True
return False
def is_aggregate(field: str) -> bool:
field_match = re.match(AGGREGATE_PATTERN, field)
equation_match = re.match(AGGREGATE_BASE, field) and is_equation(field)
return (field_match or equation_match) is not None

@shruthilayaj shruthilayaj merged commit ec1a7c0 into master Oct 22, 2021
@shruthilayaj shruthilayaj deleted the fix/pick-first-y-axis-for-unfurls branch October 22, 2021 15:23
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants