Skip to content

Commit

Permalink
Extract includeYears - dummy version
Browse files Browse the repository at this point in the history
  • Loading branch information
apauley committed May 11, 2019
1 parent 8d94568 commit 569d98d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/Hledger/Flow/Common.hs
Expand Up @@ -452,3 +452,6 @@ listOwners opts = fmap basename $ lsDirs $ (baseDir opts) </> "import"

intPath :: Int -> FilePath
intPath = fromText . (format d)

includeYears :: FilePath -> IO [Int]
includeYears includeFile =return [2016, 2017]
12 changes: 7 additions & 5 deletions src/Hledger/Flow/Reports.hs
Expand Up @@ -33,13 +33,15 @@ generateReports' :: ReportOptions -> TChan FlowTypes.LogMessage -> IO [Either Fi
generateReports' opts ch = do
channelOutLn ch "Report generation has not been fully implemented yet. Keep an eye out for report pull requests: https://github.com/apauley/hledger-flow/pulls"
owners <- single $ shellToList $ listOwners opts
let reportParams = [(journalFile opts [], outputDir opts [])] ++ map (ownerParams opts) owners
let actions = List.concat $ fmap (\params -> generateReports'' opts ch params) reportParams
let baseJournal = journalFile opts []
let baseReportDir = outputDir opts []
years <- includeYears baseJournal
let reportParams = [(baseJournal, baseReportDir)] ++ map (ownerParams opts) owners
let actions = List.concat $ fmap (generateReports'' opts ch years) reportParams
if (sequential opts) then sequence actions else single $ shellToList $ parallel actions

generateReports'' :: ReportOptions -> TChan FlowTypes.LogMessage -> (FilePath, FilePath) -> [IO (Either FilePath FilePath)]
generateReports'' opts ch (journal, reportsDir) = do
let years = [2018]
generateReports'' :: ReportOptions -> TChan FlowTypes.LogMessage -> [Int] -> (FilePath, FilePath) -> [IO (Either FilePath FilePath)]
generateReports'' opts ch years (journal, reportsDir) = do
y <- years
let actions = map (\r -> r opts ch journal reportsDir y) [accountList, incomeStatement]
map (fmap fst) actions
Expand Down

0 comments on commit 569d98d

Please sign in to comment.