Skip to content

Commit

Permalink
Display times with time part first by default too
Browse files Browse the repository at this point in the history
  • Loading branch information
nevenz committed Sep 26, 2017
1 parent 775ae7c commit b5924ad
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,22 +502,29 @@ private static String getOrderForQuery(Context context, SearchQuery searchQuery)
orderByColumns.add(ProviderContract.Notes.QueryParam.DEADLINE_TIME_TIMESTAMP + " DESC");
}


} else if (so.getType() == SearchQuery.SortOrder.Type.PRIORITY) {
orderByColumns.add("COALESCE(" + ProviderContract.Notes.QueryParam.PRIORITY + ", '" + defaultPriority + "')" + (so.isAscending() ? "" : " DESC"));
}
}
} else {

} else { // No explicit ordering specified

orderByColumns.add(ProviderContract.Notes.QueryParam.BOOK_NAME);

/* Priority or default priority. */
orderByColumns.add("COALESCE(" + ProviderContract.Notes.QueryParam.PRIORITY + ", '" + defaultPriority + "')");

if (searchQuery.hasDeadline()) {
orderByColumns.add(ProviderContract.Notes.QueryParam.DEADLINE_TIME_TIMESTAMP + " IS NULL");
orderByColumns.add(ProviderContract.Notes.QueryParam.DEADLINE_TIME_START_OF_DAY);
orderByColumns.add(ProviderContract.Notes.QueryParam.DEADLINE_TIME_HOUR + " IS NULL");
orderByColumns.add(ProviderContract.Notes.QueryParam.DEADLINE_TIME_TIMESTAMP);
}

if (searchQuery.hasScheduled()) {
orderByColumns.add(ProviderContract.Notes.QueryParam.SCHEDULED_TIME_TIMESTAMP + " IS NULL");
orderByColumns.add(ProviderContract.Notes.QueryParam.SCHEDULED_TIME_START_OF_DAY);
orderByColumns.add(ProviderContract.Notes.QueryParam.SCHEDULED_TIME_HOUR + " IS NULL");
orderByColumns.add(ProviderContract.Notes.QueryParam.SCHEDULED_TIME_TIMESTAMP);
}
}
Expand Down

0 comments on commit b5924ad

Please sign in to comment.