From 9c0ebb42d18abd65989935e2c1eedafbcd28c270 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Sat, 7 Sep 2019 09:06:16 -0400 Subject: [PATCH] renamed date to gameDate --- src/Mtlstats/Control.hs | 2 +- src/Mtlstats/Report.hs | 10 +++++----- test/ReportSpec.hs | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Mtlstats/Control.hs b/src/Mtlstats/Control.hs index dd61c4e..02efaee 100644 --- a/src/Mtlstats/Control.hs +++ b/src/Mtlstats/Control.hs @@ -157,7 +157,7 @@ verifyDataC = Controller let gs = s^.progMode.gameStateL header s C.drawString "\n" - C.drawString $ " Date: " ++ date gs ++ "\n" + C.drawString $ " Date: " ++ gameDate gs ++ "\n" C.drawString $ " Game type: " ++ show (fromJust $ gs^.gameType) ++ "\n" C.drawString $ "Other team: " ++ gs^.otherTeam ++ "\n" C.drawString $ "Home score: " ++ show (fromJust $ gs^.homeScore) ++ "\n" diff --git a/src/Mtlstats/Report.hs b/src/Mtlstats/Report.hs index 0121141..518c1b0 100644 --- a/src/Mtlstats/Report.hs +++ b/src/Mtlstats/Report.hs @@ -19,7 +19,7 @@ along with this program. If not, see . -} -module Mtlstats.Report (report, date) where +module Mtlstats.Report (report, gameDate) where import Data.Maybe (fromMaybe) import Lens.Micro ((^.)) @@ -40,7 +40,7 @@ report width s = unlines $ fromMaybe [] $ do db = s^.database gs = s^.progMode.gameStateL gNum = db^.dbGames - gDate = date gs + date = gameDate gs hTeam = homeTeam gs aTeam = awayTeam gs hStats = db^.dbHomeGameStats @@ -54,7 +54,7 @@ report width s = unlines $ fromMaybe [] $ do (centre width $ aTeam ++ " " ++ show aScore ++ " AT " ++ hTeam ++ " " ++ show hScore) - , gDate + , date , centre width "STANDINGS" , "" , centre width @@ -78,8 +78,8 @@ report width s = unlines $ fromMaybe [] $ do ++ showStats tStats ] -date :: GameState -> String -date gs = fromMaybe "" $ do +gameDate :: GameState -> String +gameDate gs = fromMaybe "" $ do year <- show <$> gs^.gameYear month <- month <$> gs^.gameMonth day <- padNum 2 <$> gs^.gameDay diff --git a/test/ReportSpec.hs b/test/ReportSpec.hs index c33dad5..dafe415 100644 --- a/test/ReportSpec.hs +++ b/test/ReportSpec.hs @@ -29,19 +29,19 @@ import Mtlstats.Types spec :: Spec spec = describe "Mtlstats.Report" - dateSpec + gameDateSpec -dateSpec :: Spec -dateSpec = describe "date" $ do +gameDateSpec :: Spec +gameDateSpec = describe "gameDate" $ do - context "valid date" $ + context "valid gameDate" $ it "should format the date" $ let gs = newGameState & gameYear ?~ 1980 & gameMonth ?~ 6 & gameDay ?~ 25 - in date gs `shouldBe` "JUN 25 1980" + in gameDate gs `shouldBe` "JUN 25 1980" context "invalid date" $ it "should return an empty string" $ - date newGameState `shouldBe` "" + gameDate newGameState `shouldBe` ""