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