показ заявок с высоким приоритетом в самом верху списка и пометка восклицательным знаком

This commit is contained in:
Professional 2025-03-19 23:04:12 +07:00
parent 583c408cec
commit c106e1cac3

View File

@ -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<InlineKeyboardButton[]>();
@ -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<InlineKeyboardButton[]>();
@ -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