Skip to content

Commit 6eb50c2

Browse files
authored
Merge pull request #4 from purple-jwl/change-sort-logic
AC数で降順ソートする
2 parents 4a0fc35 + cb55eb6 commit 6eb50c2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ function getMotivatedUsers(atcoderIds: string[], targetDate: string): MotivatedU
155155
})
156156
});
157157

158+
result.sort((a, b) => {
159+
if (a.submissions.length === b.submissions.length) {
160+
if (a.atcoderId < b.atcoderId) return -1;
161+
if (a.atcoderId > b.atcoderId) return 1;
162+
return 0;
163+
}
164+
165+
return b.submissions.length - a.submissions.length;
166+
});
167+
158168
return result;
159169
}
160170

0 commit comments

Comments
 (0)