renamed date to gameDate

This commit is contained in:
Jonathan Lamothe 2019-09-07 09:06:16 -04:00
parent dc2f632563
commit 9c0ebb42d1
3 changed files with 12 additions and 12 deletions

View File

@ -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"

View File

@ -19,7 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
-}
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

View File

@ -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` ""