From 3f5b5727e3ff21491dfcfae325bde4db81d13c0d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 14 Oct 2020 16:43:55 +0200 Subject: [PATCH] refactor: hlint --- src/Model/Migration.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Model/Migration.hs b/src/Model/Migration.hs index 4c0b6ea0b..f38c00af5 100644 --- a/src/Model/Migration.hs +++ b/src/Model/Migration.hs @@ -193,15 +193,13 @@ migrateAlwaysSafe = do let missingChangelogItems = Set.toList $ Set.fromList universeF `Set.difference` recordedChangelogItems' where recordedChangelogItems' = Set.fromList [ changelogItemFirstSeenItem | Entity _ ChangelogItemFirstSeen{..} <- recordedChangelogItems ] unless (null missingChangelogItems) $ do - now <- iso8601Show . localDay . TZ.utcToLocalTimeTZ appTZ <$> liftIO getCurrentTime + today <- localDay . TZ.utcToLocalTimeTZ appTZ <$> liftIO getCurrentTime addMigration False $ do let sql = [st|INSERT INTO changelog_item_first_seen (item, first_seen) VALUES #{vals}|] vals = Text.intercalate ", " $ do item <- missingChangelogItems - let itemDay = case Map.lookup item changelogItemDays of - Just d -> iso8601Show d - Nothing -> now - return [st|('#{toPathPiece item}', '#{itemDay}')|] + let itemDay = Map.findWithDefault today item changelogItemDays + return [st|('#{toPathPiece item}', '#{iso8601Show itemDay}')|] in sql {-