Skip to content

Commit 330ea7a

Browse files
committed
made sort better
1 parent 1c97098 commit 330ea7a

File tree

1 file changed

+3
-1
lines changed
  • course-matrix/frontend/src/pages/Home

1 file changed

+3
-1
lines changed

course-matrix/frontend/src/pages/Home/Home.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ const Home = () => {
7373
) : (
7474
[...data]
7575
.sort((a: Timetable, b: Timetable) => {
76+
if(a.favorite==b.favorite)
77+
return (b?.updated_at.localeCompare(a?.updated_at));
7678
if(a.favorite) return 1;
7779
if(b.favorite) return -1;
78-
return b?.updated_at.localeCompare(a?.updated_at);
80+
return 0;
7981
})
8082
.map((timetable) => (
8183
<TimetableCard

0 commit comments

Comments
 (0)