Merge pull request #81 from mtlstats/page-break
add page break to report
This commit is contained in:
commit
7ca66ad801
|
@ -2,6 +2,7 @@
|
|||
|
||||
## current
|
||||
- Ask for database to load on start-up
|
||||
- Add page break to report file
|
||||
|
||||
## 0.14.0
|
||||
- Fixed a bug that was causing shutouts to not be recorded
|
||||
|
|
|
@ -206,7 +206,7 @@ reportC = Controller
|
|||
C.drawString $ unlines $ slice
|
||||
(s^.scrollOffset)
|
||||
(fromInteger $ pred rows)
|
||||
(report (fromInteger $ pred cols) s)
|
||||
(displayReport (fromInteger $ pred cols) s)
|
||||
return C.CursorInvisible
|
||||
, handleController = \e -> do
|
||||
case e of
|
||||
|
@ -215,7 +215,7 @@ reportC = Controller
|
|||
C.EventSpecialKey C.KeyHome -> modify $ scrollOffset .~ 0
|
||||
|
||||
C.EventCharacter '\n' -> do
|
||||
get >>= liftIO . writeFile reportFilename . unlines . report reportCols
|
||||
get >>= liftIO . writeFile reportFilename . exportReport reportCols
|
||||
modify backHome
|
||||
|
||||
_ -> return ()
|
||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
|
||||
-}
|
||||
|
||||
module Mtlstats.Report (report, gameDate) where
|
||||
module Mtlstats.Report (displayReport, exportReport, gameDate) where
|
||||
|
||||
import Data.List (sortOn)
|
||||
import qualified Data.Map as M
|
||||
|
@ -34,21 +34,37 @@ import Mtlstats.Helpers.Player
|
|||
import Mtlstats.Types
|
||||
import Mtlstats.Util
|
||||
|
||||
-- | Generates the report
|
||||
report
|
||||
-- | Generates the report displayed on screen
|
||||
displayReport
|
||||
:: Int
|
||||
-- ^ The number of columns for the report
|
||||
-> ProgState
|
||||
-- ^ The program state
|
||||
-> [String]
|
||||
displayReport width s
|
||||
= report width s
|
||||
++ [""]
|
||||
++ lifetimeStatsReport width s
|
||||
|
||||
-- | Generates the report to be exported to file
|
||||
exportReport
|
||||
:: Int
|
||||
-- ^ The number of columns in the report
|
||||
-> ProgState
|
||||
-- ^ The program state
|
||||
-> String
|
||||
exportReport width s
|
||||
= unlines (report width s)
|
||||
++ "\f"
|
||||
++ unlines (lifetimeStatsReport width s)
|
||||
|
||||
report :: Int -> ProgState -> [String]
|
||||
report width s
|
||||
= standingsReport width s
|
||||
++ [""]
|
||||
++ gameStatsReport width s
|
||||
++ [""]
|
||||
++ yearToDateStatsReport width s
|
||||
++ [""]
|
||||
++ lifetimeStatsReport width s
|
||||
|
||||
standingsReport :: Int -> ProgState -> [String]
|
||||
standingsReport width s = fromMaybe [] $ do
|
||||
|
|
Loading…
Reference in New Issue
Block a user