Search in sources :

Example 1 with SortOrder

use of com.ichi2.libanki.SortOrder in project Anki-Android by ankidroid.

the class Sched method _fillDyn.

private List<Long> _fillDyn(@NonNull Deck deck) {
    JSONArray terms = deck.getJSONArray("terms").getJSONArray(0);
    String search = terms.getString(0);
    int limit = terms.getInt(1);
    int order = terms.getInt(2);
    SortOrder orderlimit = new SortOrder.AfterSqlOrderBy(_dynOrder(order, limit));
    if (!TextUtils.isEmpty(search.trim())) {
        search = String.format(Locale.US, "(%s)", search);
    }
    search = String.format(Locale.US, "%s -is:suspended -is:buried -deck:filtered -is:learn", search);
    List<Long> ids = mCol.findCards(search, orderlimit);
    if (ids.isEmpty()) {
        return ids;
    }
    // move the cards over
    mCol.log(deck.getLong("id"), ids);
    _moveToDyn(deck.getLong("id"), ids);
    return ids;
}
Also used : JSONArray(com.ichi2.utils.JSONArray) SortOrder(com.ichi2.libanki.SortOrder)

Aggregations

SortOrder (com.ichi2.libanki.SortOrder)1 JSONArray (com.ichi2.utils.JSONArray)1