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

feat: default categorisation change #180

Merged
merged 3 commits into from
Jan 24, 2023

Conversation

saminahbab
Copy link
Contributor

What

Describe what you have changed and why.

How to review

Describe the steps required to test the changes.

Who can review

Describe who worked on the changes, so that other people can review.

api/categorisation.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@saminahbab saminahbab force-pushed the patch/defaul-cat-failure-case branch 2 times, most recently from 890df53 to e658809 Compare January 20, 2023 16:13
// RetrieveDefaultCategorisation takes dimension, returns categorisations, and checks if any are default.
// if so, it returns the relevant information. If there are no default categorisations, it returns empty string
// for default categorisation, and the original dimension name and label to persist instead.
func (api *API) RetrieveDefaultCategorisation(dimension *model.Dimension, datasetName string) (string, string, string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Preference for return will be either to introduce a struct or named return variables. Function signature is not obvious enough to explain what these 3 returned strings are

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the named variables add too many extra lines of code, and a struct feels overkill for just one function, @j-s-rawat can I just add a comment that explains the return signature?

Copy link
Contributor

Choose a reason for hiding this comment

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

To be honest this seems like a bit of a code smell that the function is trying to do too much. It may be better to split it up into two (or more).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

given the need for the changes soon, this will be dealt with in a future refactor

api/categorisation.go Outdated Show resolved Hide resolved
@saminahbab saminahbab force-pushed the patch/defaul-cat-failure-case branch 3 times, most recently from a6629df to 7ed524f Compare January 24, 2023 11:38
@saminahbab saminahbab merged commit 7ed524f into develop Jan 24, 2023
@saminahbab saminahbab deleted the patch/defaul-cat-failure-case branch January 24, 2023 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants