diff options
author | desperateCoder <echotodevnull@gmail.com> | 2021-02-02 14:10:58 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2021-02-02 14:10:58 +0300 |
commit | 8e9fd574d857ac8b91e8c67596c128ad110f6e70 (patch) | |
tree | f78585d593ec7991ef6af012186797db8be2fb0f /app | |
parent | 9204aeab32cdee5263eb97d5071d88238b4f7e5c (diff) |
#819 no due cards only shown if on shared board
Diffstat (limited to 'app')
3 files changed, 14 insertions, 2 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java index 9c6b1ec34..32ca0f175 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java @@ -1327,12 +1327,18 @@ public class DataBaseAdapter { private void handleWidgetTypeExtras(FilterWidget filterWidget, Collection<FullCard> cardsResult) { if (filterWidget.getWidgetType() == EWidgetType.UPCOMING_WIDGET) { + // https://github.com/stefan-niedermann/nextcloud-deck/issues/819 "no due" cards are only shown if they are on a shared board + for (FullCard fullCard : new ArrayList<>(cardsResult)) { + if (fullCard.getCard().getDueDate() == null && !db.getStackDao().isStackOnSharedBoardDirectly(fullCard.getCard().getStackId())){ + cardsResult.remove(fullCard); + } + } // https://github.com/stefan-niedermann/nextcloud-deck/issues/800 all cards within non-shared boards need to be included List<Long> accountIds = null; if (filterWidget.getAccounts() != null && !filterWidget.getAccounts().isEmpty()) { accountIds = filterWidget.getAccounts().stream().map(a -> a.getAccountId()).collect(Collectors.toList()); } - cardsResult.addAll(db.getCardDao().getFullCardsForNonSharedBoardsDirectly(accountIds)); + cardsResult.addAll(db.getCardDao().getFullCardsForNonSharedBoardsWithDueDateForUpcomingCardsWidgetDirectly(accountIds)); } } diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java index fe703e886..e5ebb0af9 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/CardDao.java @@ -89,7 +89,10 @@ public interface CardDao extends GenericDao<Card> { @Transaction @Query("SELECT * FROM card c WHERE " + "exists(select 1 from Stack s join Board b on s.boardId = b.localId where s.localId = c.stackId and not exists(select 1 from AccessControl ac where ac.boardId = b.localId and status <> 3)) " + + "and dueDate is not null " + "and (coalesce(:accountIds, null) is null or accountId in (:accountIds)) " + "and status <> 3") - List<FullCard> getFullCardsForNonSharedBoardsDirectly(List<Long> accountIds); + List<FullCard> getFullCardsForNonSharedBoardsWithDueDateForUpcomingCardsWidgetDirectly(List<Long> accountIds); + + }
\ No newline at end of file diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDao.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDao.java index 4c52263ec..286a87402 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDao.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/StackDao.java @@ -61,4 +61,7 @@ public interface StackDao extends GenericDao<Stack> { @Query("SELECT coalesce(MAX(`order`), -1) FROM stack s WHERE boardId = :localBoardId") Integer getHighestStackOrderInBoard(long localBoardId); + + @Query("SELECT exists(select 1 from Stack s join Board b on s.boardId = b.localId where s.localId = :localStackId and exists(select 1 from AccessControl ac where ac.boardId = b.localId and status <> 3))") + boolean isStackOnSharedBoardDirectly(Long localStackId); }
\ No newline at end of file |