Skip to content

fix sorting #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ private static void questionOfToday() {
QuestionManager.dayQuestion = null;
} else {
QuestionManager.dayQuestion = JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONArray("todayRecord").getJSONObject(0).getJSONObject("question").getString("questionFrontendId");
return;
}
} catch (Exception e1) {
}
Expand Down Expand Up @@ -411,18 +412,16 @@ public QuestionComparator(Sort sort) {

@Override
public int compare(Question o1, Question o2) {
if (o1.equals(dayQuestion)) {
if (o1.getFrontendQuestionId().equals(dayQuestion)) {
return -1;
} else if (o2.getFrontendQuestionId().equals(dayQuestion)) {
return 1;
}
int order = 0;
if (Constant.SORT_TYPE_ID.equals(sort.getSlug())) {
String frontendId0 = o1.getFrontendQuestionId();
String frontendId1 = o2.getFrontendQuestionId();
if (frontendId0.equals(dayQuestion)) {
return -1;
} else if (frontendId1.equals(dayQuestion)) {
order = 1;
} else if (StringUtils.isNumeric(frontendId0) && StringUtils.isNumeric(frontendId1)) {
if (StringUtils.isNumeric(frontendId0) && StringUtils.isNumeric(frontendId1)) {
order = Integer.valueOf(frontendId0).compareTo(Integer.valueOf(frontendId1));
} else if (StringUtils.isNumeric(frontendId0)) {
order = -1;
Expand Down