Skip to content

Commit

Permalink
fix(done): Fix crash when filtering for both, done and due date at th…
Browse files Browse the repository at this point in the history
…e same time

Signed-off-by: Stefan Niedermann <[email protected]>
  • Loading branch information
stefan-niedermann committed Jan 18, 2024
1 parent 598d87f commit 152bc59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,19 @@ private SimpleSQLiteQuery getQueryForFilter(@NonNull FilterInformation filter, @
if (filter.getDueType() != EDueType.NO_FILTER) {
switch (filter.getDueType()) {
case NO_DUE:
query.append("and c.dueDate is null");
query.append("and c.dueDate is null ");
break;
case OVERDUE:
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') <= datetime('now', 'localtime')");
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') <= datetime('now', 'localtime') ");
break;
case TODAY:
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+24 hour', 'localtime')");
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+24 hour', 'localtime') ");
break;
case WEEK:
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+7 day', 'localtime')");
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+7 day', 'localtime') ");
break;
case MONTH:
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+30 day', 'localtime')");
query.append("and datetime(c.duedate/1000, 'unixepoch', 'localtime') between datetime('now', 'localtime') and datetime('now', '+30 day', 'localtime') ");
break;
default:
throw new IllegalArgumentException("You need to add your new " + EDueType.class.getSimpleName() + " value\"" + filter.getDueType() + "\" here!");
Expand All @@ -374,10 +374,10 @@ private SimpleSQLiteQuery getQueryForFilter(@NonNull FilterInformation filter, @
if (filter.getDoneType() != EDoneType.NO_FILTER) {
switch (filter.getDoneType()) {
case DONE:
query.append("and (c.done is not null and c.done != 0)");
query.append("and (c.done is not null and c.done != 0) ");
break;
case UNDONE:
query.append("and (c.done is null or c.done = 0)");
query.append("and (c.done is null or c.done = 0) ");
break;
default:
throw new IllegalArgumentException("You need to add your new " + EDoneType.class.getSimpleName() + " value\"" + filter.getDueType() + "\" here!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public boolean supportsFileAttachments() {
* @see <a href="https://github.com/nextcloud/deck/issues/534">Deck server issue #534</a>
*/
public boolean supportsDone() {
return isGreaterOrEqualTo(VERSION_1_12_0);
return isGreaterOrEqualTo(VERSION_1_12_2);
}

/**
Expand Down

0 comments on commit 152bc59

Please sign in to comment.