нахуй эту сортировку, попробуем только значок ставить

This commit is contained in:
Professional 2025-03-19 23:15:18 +07:00
parent c414e5f00c
commit 749e808be5

View File

@ -564,7 +564,7 @@ class Program
var command = connection.CreateCommand();
command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status != 'закрыта'";
var reports = new List<(long Id, string Description, string Status, string Priority)>();
var buttons = new List<InlineKeyboardButton[]>();
using (var reader = await command.ExecuteReaderAsync())
{
@ -574,32 +574,17 @@ class Program
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
string status = reader.GetString(2);
string priority = reader.GetString(3);
reports.Add((id, description, status, priority));
}
}
// Сортируем заявки по приоритету
var highPriorityReports = reports.Where(r => r.Priority.ToLower() == "высокий").ToList();
var mediumPriorityReports = reports.Where(r => r.Priority.ToLower() == "средний").ToList();
var lowPriorityReports = reports.Where(r => r.Priority.ToLower() == "низкий").ToList();
var sortedReports = highPriorityReports.Concat(mediumPriorityReports).Concat(lowPriorityReports).ToList();
var buttons = new List<InlineKeyboardButton[]>();
foreach (var report in sortedReports)
{
string statusEmoji = GetStatusEmoji(report.Status);
string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : "";
string statusEmoji = GetStatusEmoji(status);
string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : "";
buttons.Add(new[]
{
InlineKeyboardButton.WithCallbackData(
$"{priorityMarker} #{report.Id} - {statusEmoji} {report.Status} - {report.Description}...",
$"report_{report.Id}")
$"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...",
$"report_{id}")
});
}
}
// Добавляем кнопки навигации
buttons.Add(new[]
@ -622,13 +607,6 @@ class Program
}
}
private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId)
{
string connectionString = "Data Source=bot.db";
@ -641,7 +619,7 @@ class Program
var command = connection.CreateCommand();
command.CommandText = "SELECT Id, Description, Status, Priority FROM Reports WHERE Status = 'закрыта'";
var reports = new List<(long Id, string Description, string Status, string Priority)>();
var buttons = new List<InlineKeyboardButton[]>();
using (var reader = await command.ExecuteReaderAsync())
{
@ -651,32 +629,17 @@ class Program
string description = reader.GetString(1).Substring(0, Math.Min(20, reader.GetString(1).Length));
string status = reader.GetString(2);
string priority = reader.GetString(3);
reports.Add((id, description, status, priority));
}
}
// Сортируем заявки по приоритету
var highPriorityReports = reports.Where(r => r.Priority.ToLower() == "высокий").ToList();
var mediumPriorityReports = reports.Where(r => r.Priority.ToLower() == "средний").ToList();
var lowPriorityReports = reports.Where(r => r.Priority.ToLower() == "низкий").ToList();
var sortedReports = highPriorityReports.Concat(mediumPriorityReports).Concat(lowPriorityReports).ToList();
var buttons = new List<InlineKeyboardButton[]>();
foreach (var report in sortedReports)
{
string statusEmoji = GetStatusEmoji(report.Status);
string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : "";
string statusEmoji = GetStatusEmoji(status);
string priorityMarker = priority.ToLower() == "высокий" ? "⚠️" : "";
buttons.Add(new[]
{
InlineKeyboardButton.WithCallbackData(
$"{priorityMarker} #{report.Id} - {statusEmoji} {report.Status} - {report.Description}...",
$"report_{report.Id}")
$"{priorityMarker} #{id} - {statusEmoji} {status} - {description}...",
$"report_{id}")
});
}
}
// Добавляем кнопки навигации
buttons.Add(new[]