From ad6094898c8d3b7ff28d89e35ec57c3f09e73741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Musil?= Date: Tue, 12 May 2026 09:45:40 +0200 Subject: [PATCH] Sort menu items: active first, then by price asc, then by number Co-Authored-By: Claude Sonnet 4.6 --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4b4e152..eed7ba4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,6 +39,8 @@ function formatMenu(menu: ParsedMenu): string { } const sorted = [...menu.items].sort((a, b) => { + if (a.inactive !== b.inactive) return a.inactive ? 1 : -1 + if (a.price !== b.price) return a.price - b.price const na = parseInt(a.name.match(/^(\d+)\./)?.[1] ?? "99", 10) const nb = parseInt(b.name.match(/^(\d+)\./)?.[1] ?? "99", 10) return na - nb @@ -58,6 +60,7 @@ async function tg(text: string): Promise { return } await sendMessage(config.telegram.botToken, config.telegram.chatId, text) + console.log(`TG sent: ${text.slice(0, 80)}${text.length > 80 ? "…" : ""}`) } async function main() {