Skip to content

Commit

Permalink
order label proposals by alphabetical order rather than by usage count
Browse files Browse the repository at this point in the history
  • Loading branch information
desperateCoder committed Jan 12, 2025
1 parent 33a7f1e commit 16b32cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ public interface LabelDao extends GenericDao<Label> {
@Query("SELECT * FROM label WHERE accountId = :accountId and (status<>1 or id is null or lastModified <> lastModifiedLocal)")
List<Label> getLocallyChangedLabelsDirectly(long accountId);

// proposals by use count
// @Query("SELECT l.* " +
// "FROM label l LEFT JOIN joincardwithlabel j ON j.labelId = l.localId " +
// "WHERE l.accountId = :accountId AND l.boardId = :boardId " +
// "AND NOT EXISTS (" +
// "select 1 from joincardwithlabel jl where jl.labelId = l.localId " +
// "and jl.cardId = :notAssignedToLocalCardId AND status <> 3" + // not LOCAL_DELETED
// ") " +
// "GROUP BY l.localId ORDER BY count(*) DESC")
// LiveData<List<Label>> findProposalsForLabelsToAssign(long accountId, long boardId, long notAssignedToLocalCardId);

// proposal by alphabetical order
@Query("SELECT l.* " +
"FROM label l LEFT JOIN joincardwithlabel j ON j.labelId = l.localId " +
"FROM label l " +
"WHERE l.accountId = :accountId AND l.boardId = :boardId " +
"AND NOT EXISTS (" +
"select 1 from joincardwithlabel jl where jl.labelId = l.localId " +
"and jl.cardId = :notAssignedToLocalCardId AND status <> 3" + // not LOCAL_DELETED
") " +
"GROUP BY l.localId ORDER BY count(*) DESC")
"order by l.title asc")
LiveData<List<Label>> findProposalsForLabelsToAssign(long accountId, long boardId, long notAssignedToLocalCardId);


Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sun Jan 12 15:05:23 CET 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 16b32cd

Please sign in to comment.