Search in sources :

Example 1 with SchedTimingToday

use of com.ichi2.libanki.backend.model.SchedTimingToday in project Anki-Android by ankidroid.

the class SchedV2 method _updateCutoff.

/**
 * Daily cutoff ************************************************************* **********************************
 * This function uses GregorianCalendar so as to be sensitive to leap years, daylight savings, etc.
 */
/* Overriden: other way to count time*/
@RustCleanup("remove timing == null check once JavaBackend is removed")
public void _updateCutoff() {
    int oldToday = mToday == null ? 0 : mToday;
    SchedTimingToday timing = _timingToday();
    if (timing == null) {
        mToday = _daysSinceCreation();
        mDayCutoff = _dayCutoff();
    } else if (_new_timezone_enabled()) {
        mToday = timing.days_elapsed();
        mDayCutoff = timing.next_day_at();
    } else {
        mToday = _daysSinceCreation();
        mDayCutoff = _dayCutoff();
    }
    if (oldToday != mToday) {
        mCol.log(mToday, mDayCutoff);
    }
    // instead
    for (Deck deck : mCol.getDecks().all()) {
        update(deck);
    }
    // unbury if the day has rolled over
    int unburied = mCol.get_config("lastUnburied", 0);
    if (unburied < mToday) {
        SyncStatus.ignoreDatabaseModification(this::unburyCards);
        mCol.set_config("lastUnburied", mToday);
    }
}
Also used : SchedTimingToday(com.ichi2.libanki.backend.model.SchedTimingToday) Deck(com.ichi2.libanki.Deck) RustCleanup(net.ankiweb.rsdroid.RustCleanup)

Aggregations

Deck (com.ichi2.libanki.Deck)1 SchedTimingToday (com.ichi2.libanki.backend.model.SchedTimingToday)1 RustCleanup (net.ankiweb.rsdroid.RustCleanup)1