Skip to content

Commit

Permalink
feat: order models by id when no display order has been set
Browse files Browse the repository at this point in the history
  • Loading branch information
romeonicholas committed Nov 14, 2023
1 parent 4294442 commit 1a1a658
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ export class ModelOverviewComponent implements OnInit {

this.modelService.models$.pipe(untilDestroyed(this)).subscribe((models) => {
if (models) {
this.models = models.sort((a, b) => a.display_order - b.display_order);
this.models = models.sort((a, b) => {
if (a.display_order && b.display_order) {
return a.display_order - b.display_order;
} else {
return b.id - a.id;
}
});
}
});
}
Expand Down

0 comments on commit 1a1a658

Please sign in to comment.