use of com.ichi2.anki.CardBrowser.Column.CARD in project AnkiChinaAndroid by ankichinateam.
the class SchedV2 method _startingLeft.
// Overriden: V1 has type rev for relearinng
protected int _startingLeft(@NonNull Card card) {
JSONObject conf;
if (card.getType() == Consts.CARD_TYPE_RELEARNING) {
conf = _lapseConf(card);
} else {
conf = _lrnConf(card);
}
int tot = conf.getJSONArray("delays").length();
int tod = _leftToday(conf.getJSONArray("delays"), tot);
return tot + tod * 1000;
}
use of com.ichi2.anki.CardBrowser.Column.CARD in project AnkiChinaAndroid by ankichinateam.
the class SchedV2 method _rescheduleLapse.
// Overriden
protected int _rescheduleLapse(@NonNull Card card) {
JSONObject conf;
conf = _lapseConf(card);
card.setLapses(card.getLapses() + 1);
card.setFactor(Math.max(1300, card.getFactor() - 200));
int delay;
boolean suspended = _checkLeech(card, conf) && card.getQueue() == Consts.QUEUE_TYPE_SUSPENDED;
if (conf.getJSONArray("delays").length() != 0 && !suspended) {
card.setType(Consts.CARD_TYPE_RELEARNING);
delay = _moveToFirstStep(card, conf);
} else {
// no relearning steps
_updateRevIvlOnFail(card, conf);
_rescheduleAsRev(card, conf, false);
// need to reset the queue after rescheduling
if (suspended) {
card.setQueue(Consts.QUEUE_TYPE_SUSPENDED);
}
delay = 0;
}
return delay;
}
use of com.ichi2.anki.CardBrowser.Column.CARD in project AnkiChinaAndroid by ankichinateam.
the class SchedV2 method _updateStats.
public void _updateStats(@NonNull Card card, @NonNull String type, long cnt) {
String key = type + "Today";
long did = card.getDid();
List<Deck> list = mCol.getDecks().parents(did);
list.add(mCol.getDecks().get(did));
for (Deck g : list) {
JSONArray a = g.getJSONArray(key);
// add
a.put(1, a.getLong(1) + cnt);
mCol.getDecks().save(g);
}
}
use of com.ichi2.anki.CardBrowser.Column.CARD in project AnkiChinaAndroid by ankichinateam.
the class SchedV2 method _nextRevIvl.
/**
* Interval management ******************************************************
* *****************************************
*/
/**
* Next interval for CARD, given EASE.
*/
protected int _nextRevIvl(@NonNull Card card, @Consts.BUTTON_TYPE int ease, boolean fuzz) {
long delay = _daysLate(card);
JSONObject conf = _revConf(card);
double fct = card.getFactor() / 1000.0;
double hardFactor = conf.optDouble("hardFactor", 1.2);
int hardMin;
if (hardFactor > 1) {
hardMin = card.getIvl();
} else {
hardMin = 0;
}
int ivl2 = _constrainedIvl(card.getIvl() * hardFactor, conf, hardMin, fuzz);
if (ease == Consts.BUTTON_TWO) {
return ivl2;
}
int ivl3 = _constrainedIvl((card.getIvl() + delay / 2) * fct, conf, ivl2, fuzz);
if (ease == Consts.BUTTON_THREE) {
return ivl3;
}
int ivl4 = _constrainedIvl(((card.getIvl() + delay) * fct * conf.getDouble("ease4")), conf, ivl3, fuzz);
return ivl4;
}
use of com.ichi2.anki.CardBrowser.Column.CARD in project AnkiChinaAndroid by ankichinateam.
the class SchedV2 method _lapseConf.
// Overridden: different delays for filtered cards.
@NonNull
protected JSONObject _lapseConf(@NonNull Card card) {
DeckConfig conf = _cardConf(card);
// normal deck
if (card.getODid() == 0) {
return conf.getJSONObject("lapse");
}
// dynamic deck; override some attributes, use original deck for others
DeckConfig oconf = mCol.getDecks().confForDid(card.getODid());
JSONObject dict = new JSONObject();
// original deck
dict.put("minInt", oconf.getJSONObject("lapse").getInt("minInt"));
dict.put("leechFails", oconf.getJSONObject("lapse").getInt("leechFails"));
dict.put("leechAction", oconf.getJSONObject("lapse").getInt("leechAction"));
dict.put("mult", oconf.getJSONObject("lapse").getDouble("mult"));
dict.put("delays", oconf.getJSONObject("lapse").getJSONArray("delays"));
// overrides
dict.put("resched", conf.getBoolean("resched"));
return dict;
}
Aggregations