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

Add utils for ranking and finding labels #2

Merged
merged 4 commits into from
Oct 2, 2024
Merged

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Sep 11, 2024

Implementation and test cases inspired by arches.app.utils.i18n python module

Copy link

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

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

Looks good! Few small comments && I noticed that test coverage decreased by ~2%. If it's easy enough I'd say shore it up but I'm not super worried about it.

Neither here nor there but I bleh I hate having 2 sources of truth for a thing 🤢 . Let's just hope the python label ranking util doesn't change much, or if it does we're cognizant enough to also update this.

arches_vue_utils/src/arches_vue_utils/types.ts Outdated Show resolved Hide resolved
arches_vue_utils/src/arches_vue_utils/types.ts Outdated Show resolved Hide resolved
} from "@/arches_vue_utils/types";

/* Port of rank_label in arches.app.utils.i18n python module */
export const rankLabel = (
Copy link

Choose a reason for hiding this comment

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

non-blocking nit: I've started developing a pretty strong opinion about function declarations vs function expressions. It really doesn't matter in this context but if you've also got strong opinions in general it'd be fun to chat 😄

Copy link

@chrabyrd chrabyrd left a comment

Choose a reason for hiding this comment

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

looks good!

Comment on lines +16 to +24
export interface WithLabels {
labels: Label[];
}

export interface WithValues {
values: Label[];
}

export type Labellable = WithLabels | WithValues;
Copy link

Choose a reason for hiding this comment

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

not blocking but if these types end up getting used elsewhere I'd say we update them to be a touch more descriptive eg (ItemWithLabels)

but not too worried about it now 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I hear you. I don't think they'll get used elsewhere. What's been maddeningly difficult here is that "item" has a technical meaning in the controlled list manager, so I was hoping to avoid that.

@jacobtylerwalls jacobtylerwalls merged commit 37e7773 into main Oct 2, 2024
5 checks passed
@jacobtylerwalls jacobtylerwalls deleted the jtw/rank-label branch October 2, 2024 18:27
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.

2 participants