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

Make sure calculation views are created and returned correctly from the API. #14681

Merged
merged 10 commits into from
Oct 3, 2024

Conversation

samwho
Copy link
Collaborator

@samwho samwho commented Oct 1, 2024

Description

Adds code and tests to make sure calculation views are treated correctly by the create and get view APIs. Prior to this, calculation fields were being stripped due to not being part of the table schema.

@github-actions github-actions bot added the firestorm Data/Infra/Revenue Team label Oct 1, 2024
@samwho samwho changed the base branch from master to view-calculation-sql-3 October 1, 2024 16:23
@github-actions github-actions bot added the size/m label Oct 1, 2024
Base automatically changed from view-calculation-sql-3 to master October 2, 2024 09:04
@samwho samwho changed the title View calculation sql 4 Make sure calculation views are created and returned correctly from the API. Oct 2, 2024
@samwho samwho marked this pull request as ready for review October 2, 2024 09:37
@samwho samwho requested a review from a team as a code owner October 2, 2024 09:37
@samwho samwho requested review from mike12345567 and adrinr and removed request for a team October 2, 2024 09:37
@samwho samwho enabled auto-merge October 2, 2024 13:08
packages/server/src/sdk/app/views/index.ts Outdated Show resolved Hide resolved
if (helpers.views.isCalculationField(viewSchema[key])) {
return viewSchema[key].visible !== false
}
return key in tableSchema && tableSchema[key].visible !== false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this not bypassing the view visibility?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I broke some tests while working on this and the current state of the code passes the various visibility tests I broke. I haven't changed any visibility tests. In what way would this break view visibility?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting... Good we have tests for this. I were just worried that we do const visibleFields = new Set([...visibleSchemaFields, ...visibleTableFields]), including the table fields. It might be trimmed in some post-process then

@samwho samwho requested a review from adrinr October 2, 2024 16:34
if (helpers.views.isCalculationField(viewSchema[key])) {
return viewSchema[key].visible !== false
}
return key in tableSchema && tableSchema[key].visible !== false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting... Good we have tests for this. I were just worried that we do const visibleFields = new Set([...visibleSchemaFields, ...visibleTableFields]), including the table fields. It might be trimmed in some post-process then

@samwho samwho merged commit 3e501b9 into master Oct 3, 2024
12 checks passed
@samwho samwho deleted the view-calculation-sql-4 branch October 3, 2024 08:27
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants