Formatting
Build and Deploy / build-and-deploy (push) Successful in 14m49s

This commit is contained in:
2026-05-26 07:25:18 -04:00
parent d22c8a79d4
commit 6a7374c912
2 changed files with 10 additions and 8 deletions
+9 -7
View File
@@ -105,15 +105,17 @@ insertEntry conn filename day mComment = do
fromMaybe d Nothing = d fromMaybe d Nothing = d
fromMaybe _ (Just x) = x fromMaybe _ (Just x) = x
-- | Fetch all entries for a given recipe, newest first. {- | Fetch all entries for a given recipe, newest first.
-- Tries both the normalized key and with @.cook@ appended (for legacy entries). Tries both the normalized key and with @.cook@ appended (for legacy entries).
-}
fetchEntries :: Connection -> Text -> IO [CookEntry] fetchEntries :: Connection -> Text -> IO [CookEntry]
fetchEntries conn filename = do fetchEntries conn filename = do
entries <- SQL.query entries <-
conn SQL.query
"SELECT id, recipe_filename, cooked_date, comment, created_at \ conn
\ FROM cook_log WHERE recipe_filename = ? ORDER BY cooked_date DESC, id DESC" "SELECT id, recipe_filename, cooked_date, comment, created_at \
(Only filename) \ FROM cook_log WHERE recipe_filename = ? ORDER BY cooked_date DESC, id DESC"
(Only filename)
if null entries if null entries
then then
SQL.query SQL.query
+1 -1
View File
@@ -21,9 +21,9 @@ import qualified Data.ByteString.Lazy as LB
import Data.Char (digitToInt, isAlphaNum, toLower) import Data.Char (digitToInt, isAlphaNum, toLower)
import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef, writeIORef) import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef, writeIORef)
import Data.List (isSuffixOf, sortOn) import Data.List (isSuffixOf, sortOn)
import Data.Ord (Down (Down))
import Data.Map.Strict (Map) import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map
import Data.Ord (Down (Down))
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import Data.Text.Encoding (encodeUtf8) import Data.Text.Encoding (encodeUtf8)