diff --git a/src/Roux/CookLog.hs b/src/Roux/CookLog.hs index df15c8d..cd9fd2f 100644 --- a/src/Roux/CookLog.hs +++ b/src/Roux/CookLog.hs @@ -131,4 +131,4 @@ fetchAllEntries conn = SQL.query_ conn "SELECT id, recipe_filename, cooked_date, comment, created_at \ - \ FROM cook_log ORDER BY cooked_date DESC, id DESC" + \ FROM cook_log ORDER BY cooked_date ASC, id DESC" diff --git a/src/Roux/Server.hs b/src/Roux/Server.hs index c52f42b..6aa07e2 100644 --- a/src/Roux/Server.hs +++ b/src/Roux/Server.hs @@ -668,9 +668,10 @@ handleRequest recipeDir state db request respond = do entries <- CookLog.fetchAllEntries db let grouped = groupEntries entries recipeTitleLookup fn = - case Map.lookup (map toLower (stripCookExt (T.unpack fn))) recipes of - Just info -> Idx.riTitle info - Nothing -> fn + maybe + fn + Idx.riTitle + (Map.lookup (map toLower (stripCookExt (T.unpack fn))) recipes) respond $ htmlResponse (Html.cookHistoryPage recipeTitleLookup grouped) -- Cook log JSON endpoint for all entries ["cook-log"] -> do