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

#10191 Feat: Auto ordering of groups on comparision tab done #4839

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/pages/groupComparison/groupSelector/GroupSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ export default class GroupSelector extends React.Component<
index={buttons.length}
/>
);
// Logic To Put Primary First
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think we need to extract the logic here (163 onward) and put it in a testable function. also we shouldn't be "editing" the props of a group. we need to use functional approach and produce a new ordered data (or do ordering upstream)

Choose a reason for hiding this comment

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

True that, allow me some time to work on this. Thanks!

let buttons_: any[] = [];
buttons_[0] = buttons[1];
buttons_[1] = buttons[0];
// console.log("chk", buttons[0].props.group, buttons[1].props.group, buttons_[0].props.group, buttons_[1].props.group)
buttons_[0].props.group.ordinal = 'A';
buttons_[1].props.group.ordinal = 'B';
// buttons_[0].props.group.nameWithOrdinal = buttons[1].props.group.nameWithOrdinal;
// buttons_[1].props.group.nameWithOrdinal = buttons[0].props.group.nameWithOrdinal;
return (
<div
data-tour="single-study-group-comparison-groups"
Expand Down