コード例 #1
0
ファイル: StatsRenderer.cs プロジェクト: NatShep/ChoTISkazal
 private static string RenderRecomendations(UserModel user, IInterfaceTexts texts)
 {
     if (user.Zen.Rate < -15)
     {
         return(texts.Zen1WeNeedMuchMoreNewWords);
     }
     else if (user.Zen.Rate < -10)
     {
         return(texts.Zen2TranslateNewWords);
     }
     else if (user.Zen.Rate < -5)
     {
         return(texts.Zen3TranslateNewWordsAndPassExams);
     }
     else if (user.Zen.Rate < 5)
     {
         return(texts.Zen3EverythingIsGood);
     }
     else if (user.Zen.Rate < 10)
     {
         return(texts.Zen4PassExamsAndTranslateNewWords);
     }
     else if (user.Zen.Rate < 20)
     {
         return(texts.Zen5PassExams);
     }
     else
     {
         return(texts.Zen6YouNeedToLearn);
     }
 }
コード例 #2
0
ファイル: StatsRenderer.cs プロジェクト: NatShep/ChoTISkazal
        private static string Render7WeeksCalendar(
            ExamSettings examSettings, CalendarItem[] items, IInterfaceTexts texts)
        {
            var today   = DateTime.Today;
            var offsets = items.ToDictionary(
                i => (int)(today - i.Date.Date).TotalDays,
                k => k.ExamsCount / (double)examSettings.ExamsCountGoalForDay
                );
            //7 weeks. 42-49 days
            var minDay           = today.AddDays(-49);
            var undoneInLastWeek = 0;

            if (minDay.DayOfWeek != DayOfWeek.Sunday)
            {
                undoneInLastWeek = (7 - (int)minDay.DayOfWeek);
            }


            var sb = new StringBuilder("----------------------\r\n");

            for (int day = 0; day < 7; day++)
            {
                sb.Append(texts.ShortDayNames[day] + " ");
                for (int week = 7; week > 0; week--)
                {
                    var offset = 7 * week - undoneInLastWeek - day - 1;
                    if (offset < 0)
                    {
                        sb.Append(Empty);
                    }
                    else if (offsets.TryGetValue(offset, out var v))
                    {
                        var symbol
                            = v < 0.1 ? S1
                        : v < 0.2 ? S2
                        : v < 0.5 ? S3
                        : v < 1.0 ? S4
                        : v <= 2.0 ? S5
                        : S6;
                        sb.Append(symbol);
                    }
                    else
                    {
                        sb.Append(S0);
                    }
                }

                sb.Append("\r\n");
            }
            sb.Append("----------------------\r\n ");
            sb.Append($"{texts.less} {S1}{S2}{S3}{S4}{S5} {texts.more}\r\n");
            return(sb.ToString());
        }
コード例 #3
0
 public static QuestionResult Failed(IInterfaceTexts texts) => new QuestionResult(
     texts.FailedDefaultMarkdown,
     texts.FailedHideousDefaultMarkdown, ExamResult.Failed);
コード例 #4
0
 public static QuestionResult Passed(string text, IInterfaceTexts texts)
 => new QuestionResult(text, texts.PassedHideousDefaultMarkdown, ExamResult.Passed);
コード例 #5
0
ファイル: InlineButtons.cs プロジェクト: NatShep/ChoTISkazal
 public static InlineKeyboardButton Translation(IInterfaceTexts texts) =>
 Translation(texts.TranslateButton);
コード例 #6
0
ファイル: InlineButtons.cs プロジェクト: NatShep/ChoTISkazal
 public static InlineKeyboardButton MainMenu(IInterfaceTexts texts) =>
 MainMenu(texts.MainMenuButton);
コード例 #7
0
ファイル: InlineButtons.cs プロジェクト: NatShep/ChoTISkazal
 public static InlineKeyboardButton HowToUse(IInterfaceTexts texts) => new InlineKeyboardButton
 {
     CallbackData = BotCommands.Help, Text = texts.HelpButton
 };
コード例 #8
0
ファイル: InlineButtons.cs プロジェクト: NatShep/ChoTISkazal
 public static InlineKeyboardButton Stats(IInterfaceTexts texts) => new InlineKeyboardButton
 {
     CallbackData = BotCommands.Stats, Text = texts.StatsButton
 };
コード例 #9
0
ファイル: InlineButtons.cs プロジェクト: NatShep/ChoTISkazal
 public static InlineKeyboardButton Exam(IInterfaceTexts texts) =>
 Exam(texts.LearnButton);