removed redundant code (mostly imports)
This commit is contained in:
parent
5339c57d5c
commit
04140df812
|
@ -40,12 +40,10 @@ module Mtlstats.Actions
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Trans.State (modify)
|
import Control.Monad.Trans.State (modify)
|
||||||
import qualified Data.Map as M
|
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Lens.Micro (over, (^.), (&), (.~), (?~), (%~), (+~))
|
import Lens.Micro ((^.), (&), (.~), (%~))
|
||||||
|
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
import Mtlstats.Util
|
|
||||||
|
|
||||||
-- | Starts a new season
|
-- | Starts a new season
|
||||||
startNewSeason :: ProgState -> ProgState
|
startNewSeason :: ProgState -> ProgState
|
||||||
|
|
|
@ -25,6 +25,7 @@ module Mtlstats.Actions.NewGame.GoalieInput
|
||||||
, setGameGoalie
|
, setGameGoalie
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Control.Monad (void)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Lens.Micro ((^.), (&), (.~), (%~), (+~))
|
import Lens.Micro ((^.), (&), (.~), (%~), (+~))
|
||||||
|
@ -43,9 +44,9 @@ recordGoalieStats :: ProgState -> ProgState
|
||||||
recordGoalieStats s = fromMaybe s $ do
|
recordGoalieStats s = fromMaybe s $ do
|
||||||
let gs = s^.progMode.gameStateL
|
let gs = s^.progMode.gameStateL
|
||||||
gid <- gs^.gameSelectedGoalie
|
gid <- gs^.gameSelectedGoalie
|
||||||
goalie <- nth gid $ s^.database.dbGoalies
|
|
||||||
mins <- gs^.gameGoalieMinsPlayed
|
mins <- gs^.gameGoalieMinsPlayed
|
||||||
goals <- gs^.gameGoalsAllowed
|
goals <- gs^.gameGoalsAllowed
|
||||||
|
void $ nth gid $ s^.database.dbGoalies
|
||||||
|
|
||||||
let
|
let
|
||||||
gameStats = M.findWithDefault newGoalieStats gid $ gs^.gameGoalieStats
|
gameStats = M.findWithDefault newGoalieStats gid $ gs^.gameGoalieStats
|
||||||
|
|
|
@ -21,25 +21,20 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module Mtlstats.Control (dispatch) where
|
module Mtlstats.Control (dispatch) where
|
||||||
|
|
||||||
import Control.Monad (join, when)
|
import Control.Monad (join)
|
||||||
import Control.Monad.Extra (ifM)
|
|
||||||
import Control.Monad.Trans.State (gets, modify)
|
import Control.Monad.Trans.State (gets, modify)
|
||||||
import Data.Char (toUpper)
|
import Data.Maybe (fromJust)
|
||||||
import Data.Maybe (fromJust, fromMaybe, isJust)
|
import Lens.Micro ((^.))
|
||||||
import Lens.Micro ((^.), (.~), (%~))
|
|
||||||
import Lens.Micro.Extras (view)
|
import Lens.Micro.Extras (view)
|
||||||
import qualified UI.NCurses as C
|
import qualified UI.NCurses as C
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Control.EditPlayer
|
import Mtlstats.Control.EditPlayer
|
||||||
import Mtlstats.Control.NewGame
|
import Mtlstats.Control.NewGame
|
||||||
import Mtlstats.Format
|
|
||||||
import Mtlstats.Handlers
|
import Mtlstats.Handlers
|
||||||
import Mtlstats.Menu
|
import Mtlstats.Menu
|
||||||
import Mtlstats.Prompt
|
import Mtlstats.Prompt
|
||||||
import Mtlstats.Report
|
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
import Mtlstats.Util
|
|
||||||
|
|
||||||
-- | Reads the program state and returs the apropriate controller to
|
-- | Reads the program state and returs the apropriate controller to
|
||||||
-- run
|
-- run
|
||||||
|
|
|
@ -46,15 +46,13 @@ import Control.Monad.Extra (whenJust)
|
||||||
import Control.Monad.Trans.State (gets, modify)
|
import Control.Monad.Trans.State (gets, modify)
|
||||||
import Data.Char (isDigit, toUpper)
|
import Data.Char (isDigit, toUpper)
|
||||||
import Data.Foldable (forM_)
|
import Data.Foldable (forM_)
|
||||||
import Data.Maybe (fromMaybe)
|
import Lens.Micro ((^.), (&), (.~), (?~))
|
||||||
import Lens.Micro ((^.), (&), (.~), (?~), (%~))
|
|
||||||
import Lens.Micro.Extras (view)
|
import Lens.Micro.Extras (view)
|
||||||
import Text.Read (readMaybe)
|
import Text.Read (readMaybe)
|
||||||
import qualified UI.NCurses as C
|
import qualified UI.NCurses as C
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Config
|
import Mtlstats.Config
|
||||||
import Mtlstats.Format
|
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
import Mtlstats.Util
|
import Mtlstats.Util
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,10 @@ module Mtlstats.Prompt.NewGame.GoalieInput
|
||||||
, goalsAllowedPrompt
|
, goalsAllowedPrompt
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad.Trans.State (modify)
|
||||||
import Control.Monad.Trans.State (gets, modify)
|
import Lens.Micro ((?~))
|
||||||
import Data.Maybe (fromMaybe)
|
|
||||||
import Lens.Micro ((^.), (.~), (?~))
|
|
||||||
|
|
||||||
import Mtlstats.Actions.NewGame.GoalieInput
|
import Mtlstats.Actions.NewGame.GoalieInput
|
||||||
import Mtlstats.Config
|
|
||||||
import Mtlstats.Prompt
|
import Mtlstats.Prompt
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ module Mtlstats.Types.Menu (
|
||||||
|
|
||||||
import Lens.Micro ((^.))
|
import Lens.Micro ((^.))
|
||||||
import Lens.Micro.TH (makeLenses)
|
import Lens.Micro.TH (makeLenses)
|
||||||
import qualified UI.NCurses as C
|
|
||||||
|
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ spec = describe "NewGame" $ do
|
||||||
assignPMinsSpec
|
assignPMinsSpec
|
||||||
GoalieInput.spec
|
GoalieInput.spec
|
||||||
|
|
||||||
|
overtimeCheckSpec :: Spec
|
||||||
overtimeCheckSpec = describe "overtimeCheck" $ do
|
overtimeCheckSpec = describe "overtimeCheck" $ do
|
||||||
|
|
||||||
context "tie game" $ do
|
context "tie game" $ do
|
||||||
|
|
|
@ -24,16 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
module ActionsSpec (spec) where
|
module ActionsSpec (spec) where
|
||||||
|
|
||||||
import Control.Monad (replicateM)
|
import Control.Monad (replicateM)
|
||||||
import qualified Data.Map as M
|
import Lens.Micro ((^.), (&), (.~), (?~))
|
||||||
import Data.Maybe (fromJust)
|
|
||||||
import Lens.Micro ((^.), (&), (.~), (?~), (%~))
|
|
||||||
import System.Random (randomRIO)
|
|
||||||
import Test.Hspec
|
import Test.Hspec
|
||||||
( Spec
|
( Spec
|
||||||
, context
|
, context
|
||||||
, describe
|
, describe
|
||||||
, it
|
, it
|
||||||
, runIO
|
|
||||||
, shouldBe
|
, shouldBe
|
||||||
, shouldNotBe
|
, shouldNotBe
|
||||||
, shouldSatisfy
|
, shouldSatisfy
|
||||||
|
@ -41,7 +37,6 @@ import Test.Hspec
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
import Mtlstats.Util
|
|
||||||
|
|
||||||
import qualified Actions.NewGameSpec as NewGame
|
import qualified Actions.NewGameSpec as NewGame
|
||||||
import qualified TypesSpec as TS
|
import qualified TypesSpec as TS
|
||||||
|
|
|
@ -21,7 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module ReportSpec (spec) where
|
module ReportSpec (spec) where
|
||||||
|
|
||||||
import Lens.Micro ((&), (?~), (%~))
|
import Lens.Micro ((&), (?~))
|
||||||
import Test.Hspec (Spec, context, describe, it, shouldBe)
|
import Test.Hspec (Spec, context, describe, it, shouldBe)
|
||||||
|
|
||||||
import Mtlstats.Report
|
import Mtlstats.Report
|
||||||
|
|
|
@ -33,7 +33,6 @@ module TypesSpec
|
||||||
import Control.Monad (replicateM)
|
import Control.Monad (replicateM)
|
||||||
import Data.Aeson (FromJSON, ToJSON, decode, encode, toJSON)
|
import Data.Aeson (FromJSON, ToJSON, decode, encode, toJSON)
|
||||||
import Data.Aeson.Types (Value (Object))
|
import Data.Aeson.Types (Value (Object))
|
||||||
import Data.ByteString.Lazy (ByteString)
|
|
||||||
import qualified Data.HashMap.Strict as HM
|
import qualified Data.HashMap.Strict as HM
|
||||||
import Lens.Micro (Lens', (&), (^.), (.~), (?~))
|
import Lens.Micro (Lens', (&), (^.), (.~), (?~))
|
||||||
import System.Random (randomRIO)
|
import System.Random (randomRIO)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user