Skip to content

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.

3 participants