private DateTime CardReviewDate(Flashcard card) { int gap = CardReviewDaysGap(card); if (gap == 0) { return(card.dt_last_review == null ? _now : card.dt_last_review.Value.AddDays(1)); } return(card.dt_last_review.Value.AddDays(gap)); }
private int CardReviewDaysGap(Flashcard card) { // level 0: every day // level 1: every 2 day // level 2: every 4 day // level 3: every 8 day // level 4: every 16 day // level 5: every 32 day if (card.level == 0) { return(0); } return((int)Math.Pow(2, card.level)); }
public void AddCard(string front, string back) { var card = new Flashcard() { front = front, back = back, level = 0 }; _db_cards.Insert(card); var deck = _db_decks.FindAll().First(); deck.cards.Add(card); _db_decks.Update(deck); }