renamed date to gameDate
This commit is contained in:
parent
dc2f632563
commit
9c0ebb42d1
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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` ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user