implemented selectGoaliePrompt
This commit is contained in:
parent
d215f27f4f
commit
2926e28e34
|
@ -227,7 +227,25 @@ selectGoaliePrompt
|
|||
-- ^ The callback to run (takes the index number of the goalie as
|
||||
-- input)
|
||||
-> Prompt
|
||||
selectGoaliePrompt = undefined
|
||||
selectGoaliePrompt pStr callback = selectPrompt SelectParams
|
||||
{ spPrompt = pStr
|
||||
, spSearchHeader = "Goalie select:"
|
||||
, spSearch = \sStr db -> goalieSearch sStr (db^.dbGoalies)
|
||||
, spSearchExact = \sStr db -> fst <$> goalieSearchExact sStr (db^.dbGoalies)
|
||||
, spElemDesc = goalieSummary
|
||||
, spCallback = callback
|
||||
, spNotFound = \sStr -> do
|
||||
mode <- gets (^.progMode)
|
||||
let
|
||||
cgs = newCreateGoalieState
|
||||
& cgsName .~ sStr
|
||||
& cgsSuccessCallback .~ do
|
||||
modify $ progMode .~ mode
|
||||
index <- pred . length <$> gets (^.database.dbGoalies)
|
||||
callback $ Just index
|
||||
& cgsFailureCallback .~ modify (progMode .~ mode)
|
||||
modify $ progMode .~ CreateGoalie cgs
|
||||
}
|
||||
|
||||
-- | Prompts for the player who scored the goal
|
||||
recordGoalPrompt
|
||||
|
@ -287,7 +305,7 @@ goalieNamePrompt = strPrompt "Goalie name: " $
|
|||
|
||||
-- | Prompts for a goalie who played in the game
|
||||
selectGameGoaliePrompt :: Prompt
|
||||
selectGameGoaliePrompt = selectGoaliePrompt "Select goalie: " $
|
||||
selectGameGoaliePrompt = selectGoaliePrompt "Which goalie played this game: " $
|
||||
\case
|
||||
Nothing -> modify $ progMode.gameStateL.goaliesRecorded .~ True
|
||||
Just n -> modify $ progMode.gameStateL.gameSelectedGoalie ?~ n
|
||||
|
|
|
@ -149,7 +149,11 @@ module Mtlstats.Types (
|
|||
playerIsActive,
|
||||
-- ** PlayerStats Helpers
|
||||
psPoints,
|
||||
addPlayerStats
|
||||
addPlayerStats,
|
||||
-- ** Goalie Helpers
|
||||
goalieSearch,
|
||||
goalieSearchExact,
|
||||
goalieSummary
|
||||
) where
|
||||
|
||||
import Control.Monad.Trans.State (StateT)
|
||||
|
@ -830,3 +834,27 @@ addPlayerStats s1 s2 = newPlayerStats
|
|||
& psGoals .~ s1^.psGoals + s2^.psGoals
|
||||
& psAssists .~ s1^.psAssists + s2^.psAssists
|
||||
& psPMin .~ s1^.psPMin + s2^.psPMin
|
||||
|
||||
-- | Searches a list of goalies
|
||||
goalieSearch
|
||||
:: String
|
||||
-- ^ The search string
|
||||
-> [Goalie]
|
||||
-- ^ The list to search
|
||||
-> [(Int, Goalie)]
|
||||
-- ^ The search results with their corresponding index numbers
|
||||
goalieSearch = undefined
|
||||
|
||||
-- | Searches a list of goalies for an exact match
|
||||
goalieSearchExact
|
||||
:: String
|
||||
-- ^ The search string
|
||||
-> [Goalie]
|
||||
-- ^ The list to search
|
||||
-> Maybe (Int, Goalie)
|
||||
-- ^ The result with its index number
|
||||
goalieSearchExact = undefined
|
||||
|
||||
-- | Provides a description string for a 'Goalie'
|
||||
goalieSummary :: Goalie -> String
|
||||
goalieSummary = undefined
|
||||
|
|
Loading…
Reference in New Issue
Block a user