From 4f2a6bffdaadc772680ef4a996bb04bb618f1ac1 Mon Sep 17 00:00:00 2001 From: Dennis Frieberg Date: Sun, 10 Dec 2023 19:35:58 +0100 Subject: [PATCH] changed table layout and seperator --- app/Main.hs | 10 ++++------ app/TableParser.hs | 19 ++++++++----------- flake.lock | 30 ++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index ab36be2..48ea82c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -66,13 +66,11 @@ mailText :: MailRecord -> LT.Text mailText record = LT.concat ["Guten Morgen,\n\n" , announcement record ,"\n\ndiesen Donnerstag\n\nDurchsingen: " - ,song1 record - ,", " - ,song2 record + ,songs record ,"\nStimmproben: " - ,voice1 record - ,", " - ,voice2 record + ,voices record + ,"\nNoten mitbringen: " + , notes record ,"\n\nLG\nJo^^\n" ] mailSubject :: MailRecord -> T.Text diff --git a/app/TableParser.hs b/app/TableParser.hs index 3484c8a..0bbd2cc 100644 --- a/app/TableParser.hs +++ b/app/TableParser.hs @@ -14,15 +14,14 @@ import Control.Monad(void) data MailRecord = MailRecord { date :: D.Day, - voice1 :: LT.Text, - voice2 :: LT.Text, - song1 :: LT.Text, - song2 :: LT.Text, + voices :: LT.Text, + songs :: LT.Text, + notes :: LT.Text, announcement :: LT.Text } deriving (Show) seperator :: Char -seperator = '\t' +seperator = ';' sepParser :: P.Parser () sepParser = void $ P.char seperator @@ -52,19 +51,17 @@ parseRow :: P.Parser MailRecord parseRow = do date <- dateCellParser sepParser - voice1 <- textCellParser + voices <- textCellParser sepParser - voice2 <- textCellParser + songs <- textCellParser sepParser - song1 <- textCellParser - sepParser - song2 <- textCellParser + notes <- textCellParser sepParser announcement <- textCellParser return $ MailRecord{..} parseFirstRow :: P.Parser () -parseFirstRow = void (P.string "Datum\tStimmprobe 1\tStimmprobe 2\tLied 1\tLied 2\tWeitere Ansagen" >> P.endOfLine) +parseFirstRow = void (P.string "Datum;Stimmproben;Lieder;Noten;Weitere Ansagen" >> P.endOfLine) parseTable :: P.Parser [MailRecord] parseTable = do diff --git a/flake.lock b/flake.lock index 482bd22..505f2ae 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", "type": "github" }, "original": { @@ -17,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1678086707, - "narHash": "sha256-y1uXdxzinIne4FW3TF7DCtxEB9gAbQ4qnbpYzhvkFm8=", + "lastModified": 1693355128, + "narHash": "sha256-+ZoAny3ZxLcfMaUoLVgL9Ywb/57wP+EtsdNGuXUJrwg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "21eda9bc80bef824a037582b1e5a43ba74e92daa", + "rev": "a63a64b593dcf2fe05f7c5d666eb395950f36bc9", "type": "github" }, "original": { @@ -36,6 +39,21 @@ "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root",