From c106e1cac38b1f27cf23ff689e0bf49f458bd248 Mon Sep 17 00:00:00 2001 From: Professional Date: Wed, 19 Mar 2025 23:04:12 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=8F=D0=B2=D0=BE=D0=BA=20=D1=81=20=D0=B2=D1=8B=D1=81=D0=BE?= =?UTF-8?q?=D0=BA=D0=B8=D0=BC=20=D0=BF=D1=80=D0=B8=D0=BE=D1=80=D0=B8=D1=82?= =?UTF-8?q?=D0=B5=D1=82=D0=BE=D0=BC=20=D0=B2=20=D1=81=D0=B0=D0=BC=D0=BE?= =?UTF-8?q?=D0=BC=20=D0=B2=D0=B5=D1=80=D1=85=D1=83=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=B8=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=D0=BE=D1=81=D0=BA=D0=BB=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=BC=20=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index f0b7840..9baa936 100644 --- a/Program.cs +++ b/Program.cs @@ -562,7 +562,7 @@ class Program { await connection.OpenAsync(); var command = connection.CreateCommand(); - command.CommandText = "SELECT Id, Description, Status FROM Reports WHERE Status != 'закрыта'"; + command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status != 'закрыта' ORDER BY CASE Priority WHEN 'высокий' THEN 1 WHEN 'средний' THEN 2 ELSE 3 END"; var buttons = new List(); @@ -573,12 +573,14 @@ class Program long id = reader.GetInt64(0); string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length)); string status = reader.GetString(2); + string priority = reader.GetString(3); string statusEmoji = GetStatusEmoji(status); + string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : ""; buttons.Add(new[] { InlineKeyboardButton.WithCallbackData( - $"#{id} - {statusEmoji} {status} - {description}...", + $"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...", $"report_{id}") }); } @@ -608,6 +610,7 @@ class Program + private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId) { string connectionString = "Data Source=bot.db"; @@ -618,7 +621,7 @@ class Program { await connection.OpenAsync(); var command = connection.CreateCommand(); - command.CommandText = "SELECT Id, Description, Status FROM Reports WHERE Status = 'закрыта'"; + command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status = 'закрыта' ORDER BY CASE Priority WHEN 'высокий' THEN 1 WHEN 'средний' THEN 2 ELSE 3 END"; var buttons = new List(); @@ -629,12 +632,14 @@ class Program long id = reader.GetInt64(0); string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length)); string status = reader.GetString(2); + string priority = reader.GetString(3); string statusEmoji = GetStatusEmoji(status); + string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : ""; buttons.Add(new[] { InlineKeyboardButton.WithCallbackData( - $"#{id} - {statusEmoji} {status} - {description}...", + $"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...", $"report_{id}") }); } @@ -663,6 +668,7 @@ class Program + private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId) { try