private static void UpdateTestWord(ProtocolUser protocolUser)
        {
            if (!protocolUser.TodayTestWords.TryGetValue(protocolUser.TodayStudyDate, out var todayTestWords))
            {
                return;
            }

            var id = todayTestWords[protocolUser.TodayTestWordsIndex];

            if (!protocolUser.WordTestData.TryGetValue(id, out var data))
            {
                return;
            }

            data.TestPassCount++;
            data.LastPassedDate = protocolUser.TodayStudyDate;

            if (data.TestPassCount >= StaticData.TestPeriodDate.Length)
            {
                // Do nothing
            }
            else
            {
                var nextTestData = protocolUser.TodayStudyDate + StaticData.TestPeriodDate[data.TestPassCount];
                protocolUser.AddTestWord(nextTestData, data.Id);
            }
        }
예제 #2
0
        private static void AddTestWordToNextPeriod(ProtocolUser protocolUser, ProtocolUserWordStudyData data)
        {
            var testData = new ProtocolUserWordTestData
            {
                Id             = data.Id,
                LastPassedDate = protocolUser.TodayStudyDate,
                TestPassCount  = 0
            };

            protocolUser.WordTestData[testData.Id] = testData;

            var nextStudyDate = protocolUser.TodayStudyDate + StaticData.TestPeriodDate[testData.TestPassCount];

            protocolUser.AddTestWord(nextStudyDate, testData.Id);
        }