From a8fa6c508259d331c6a70444f140477b320cd289 Mon Sep 17 00:00:00 2001 From: Professional Date: Wed, 19 Mar 2025 23:09:50 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=89=D0=B5=20=D1=80=D0=B0=D0=B7=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 2348c2f..bdc47c6 100644 --- a/Program.cs +++ b/Program.cs @@ -580,11 +580,14 @@ class Program } // Сортируем заявки по приоритету - reports.Sort((x, y) => string.Compare(y.Priority, x.Priority, StringComparison.Ordinal)); + var sortedReports = reports.OrderByDescending(r => r.Priority == "высокий") + .ThenByDescending(r => r.Priority == "средний") + .ThenByDescending(r => r.Priority == "низкий") + .ToList(); var buttons = new List(); - foreach (var report in reports) + foreach (var report in sortedReports) { string statusEmoji = GetStatusEmoji(report.Status); string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : ""; @@ -623,6 +626,7 @@ class Program + private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId) { string connectionString = "Data Source=bot.db"; @@ -651,11 +655,14 @@ class Program } // Сортируем заявки по приоритету - reports.Sort((x, y) => string.Compare(y.Priority, x.Priority, StringComparison.Ordinal)); + var sortedReports = reports.OrderByDescending(r => r.Priority == "высокий") + .ThenByDescending(r => r.Priority == "средний") + .ThenByDescending(r => r.Priority == "низкий") + .ToList(); var buttons = new List(); - foreach (var report in reports) + foreach (var report in sortedReports) { string statusEmoji = GetStatusEmoji(report.Status); string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : ""; @@ -693,6 +700,7 @@ class Program + private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId) { try