Skip to content

Commit 993a2b9

Browse files
authored
Merge pull request #337 from shuzijun/gradle
fix sorting
2 parents 0f3cc51 + b064ea8 commit 993a2b9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/com/shuzijun/leetcode/plugin/manager/QuestionManager.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ private static void questionOfToday() {
313313
QuestionManager.dayQuestion = null;
314314
} else {
315315
QuestionManager.dayQuestion = JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("todayRecord").getJSONObject(0).getJSONObject("question").getString("questionFrontendId");
316+
return;
316317
}
317318
} catch (Exception e1) {
318319
}
@@ -411,18 +412,16 @@ public QuestionComparator(Sort sort) {
411412

412413
@Override
413414
public int compare(Question o1, Question o2) {
414-
if (o1.equals(dayQuestion)) {
415+
if (o1.getFrontendQuestionId().equals(dayQuestion)) {
415416
return -1;
417+
} else if (o2.getFrontendQuestionId().equals(dayQuestion)) {
418+
return 1;
416419
}
417420
int order = 0;
418421
if (Constant.SORT_TYPE_ID.equals(sort.getSlug())) {
419422
String frontendId0 = o1.getFrontendQuestionId();
420423
String frontendId1 = o2.getFrontendQuestionId();
421-
if (frontendId0.equals(dayQuestion)) {
422-
return -1;
423-
} else if (frontendId1.equals(dayQuestion)) {
424-
order = 1;
425-
} else if (StringUtils.isNumeric(frontendId0) && StringUtils.isNumeric(frontendId1)) {
424+
if (StringUtils.isNumeric(frontendId0) && StringUtils.isNumeric(frontendId1)) {
426425
order = Integer.valueOf(frontendId0).compareTo(Integer.valueOf(frontendId1));
427426
} else if (StringUtils.isNumeric(frontendId0)) {
428427
order = -1;

0 commit comments

Comments
 (0)