Пример #1
0
        private ReviewCollectionAsyncBase GetNextCardSource()
        {
            int newReviewCount   = ReviewCollectionNew.ReviewCount();
            int learnReviewCount = ReviewCollectionLearn.ReviewCount();
            int dueReviewCount   = ReviewCollectionDue.ReviewCount();

            int totalReviewCount = newReviewCount + learnReviewCount + dueReviewCount;

            int rnd = _random.Next(0, totalReviewCount);

            if (rnd < newReviewCount)
            {
                return(ReviewCollectionNew);
            }

            if (rnd < newReviewCount + learnReviewCount)
            {
                return(ReviewCollectionLearn);
            }

            if (rnd < newReviewCount + learnReviewCount + dueReviewCount)
            {
                return(ReviewCollectionDue);
            }

            return(null);
        }
Пример #2
0
        /// <summary>State-dependent counts of cards to be reviewed.</summary>
        /// <param name="state">The state.</param>
        /// <returns>State-dependent card count.</returns>
        public int CountByState(CardPracticeStateFilterFlag state)
        {
            int ret = 0;

            if ((state & CardPracticeStateFilterFlag.Due) == CardPracticeStateFilterFlag.Due)
            {
                ret += ReviewCollectionDue.ReviewCount();
            }

            if ((state & CardPracticeStateFilterFlag.Learning) == CardPracticeStateFilterFlag.Learning)
            {
                ret += ReviewCollectionLearn.ReviewCount();
            }

            if ((state & CardPracticeStateFilterFlag.New) == CardPracticeStateFilterFlag.New)
            {
                ret += ReviewCollectionNew.ReviewCount();
            }

            return(ret);
        }