еще разок

This commit is contained in:
Professional 2025-03-19 23:09:50 +07:00
parent e808cae59c
commit a8fa6c5082

View File

@ -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<InlineKeyboardButton[]>(); var buttons = new List<InlineKeyboardButton[]>();
foreach (var report in reports) foreach (var report in sortedReports)
{ {
string statusEmoji = GetStatusEmoji(report.Status); string statusEmoji = GetStatusEmoji(report.Status);
string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : ""; string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : "";
@ -623,6 +626,7 @@ class Program
private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId) private static async Task ViewArchivedReports(ITelegramBotClient botClient, long chatId)
{ {
string connectionString = "Data Source=bot.db"; 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<InlineKeyboardButton[]>(); var buttons = new List<InlineKeyboardButton[]>();
foreach (var report in reports) foreach (var report in sortedReports)
{ {
string statusEmoji = GetStatusEmoji(report.Status); string statusEmoji = GetStatusEmoji(report.Status);
string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : ""; string priorityMarker = report.Priority.ToLower() == "высокий" ? "⚠️" : "";
@ -693,6 +700,7 @@ class Program
private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId) private static async Task ShowReportDetails(ITelegramBotClient botClient, long chatId, long reportId, int messageId)
{ {
try try