Skip to content

Commit

Permalink
AG-985 ensuring Target Risk Score chart will always come first
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 committed Apr 13, 2023
1 parent d78f224 commit 6197adb
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class GeneSoeChartsComponent implements OnInit {
a.name > b.name ? 1 : -1
);

//remove literature score
// remove literature score
overallScoreDistribution = overallScoreDistribution.filter((item: any) => (item.name !== 'Literature Score'));

this.charts = overallScoreDistribution.map((item: any) => {
Expand All @@ -74,6 +74,22 @@ export class GeneSoeChartsComponent implements OnInit {
distribution,
};
});

// sort charts so Target Risk Score appears first
this.sortScoreCharts(this.charts);
});
}

sortScoreCharts(charts: any[]) {
// sort charts alphabetically on name property
charts.sort((a, b) => {
if (a.name === 'Target Risk Score') {
return -1;
} else if (b.name === 'Target Risk Score') {
return 1;
} else {
return a.name.localeCompare(b.name);
}
});
}

Expand Down

0 comments on commit 6197adb

Please sign in to comment.