orgstat 0.1.9 → 0.1.10
raw patch · 3 files changed
+24/−4 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- CHANGES.md +4/−0
- orgstat.cabal +2/−2
- src/OrgStat/Outputs/Timeline.hs +18/−2
CHANGES.md view
@@ -1,3 +1,7 @@+0.1.10+==========+* Compatibility with base-4.14+ 0.1.9 ========== * Introduced passing the list of report durations into the script type output.
orgstat.cabal view
@@ -1,5 +1,5 @@ name: orgstat-version: 0.1.9+version: 0.1.10 synopsis: Statistics visualizer for org-mode license: GPL-3 license-file: LICENSE@@ -33,7 +33,7 @@ build-depends: aeson >= 0.11.2.0 , attoparsec , ansi-terminal- , base >=4.13 && <4.14+ , base >=4.13 && <4.15 , boxes >= 0.1.4 , bytestring , colour >= 2.3.3
src/OrgStat/Outputs/Timeline.hs view
@@ -8,6 +8,7 @@ import Data.Colour.CIE (luminance) import Data.List (lookup, nub)+import qualified Data.List as L import qualified Data.Text as T import Data.Time (Day, DiffTime, LocalTime(..), defaultTimeLocale, formatTime, timeOfDayToTime) import Diagrams.Backend.SVG (B)@@ -214,8 +215,23 @@ where (hours, minutes) = diffTimeMinutes time `divMod` 60 +emptyReport :: D.Diagram B+emptyReport =+ mconcat+ [ D.strutY 20+ , D.strutX 40+ , D.alignedText 0.5 0 "empty"+ & D.font "DejaVu Sans"+ & D.fontSize 8+ ]+ timelineReport :: TimelineParams -> Org -> TimelineOutput-timelineReport params org = TimelineOutput pic+timelineReport params org =+ if (null $ concat $ org ^.. traverseTree . orgClocks)+ then+ TimelineOutput $ D.vsep 30 [emptyReport]++ else TimelineOutput pic where lookupDef :: Eq a => b -> a -> [(a, b)] -> b lookupDef d a xs = fromMaybe d $ lookup a xs@@ -223,7 +239,7 @@ -- These two should be taken from the Org itself (min/max). (from,to) = let c = concat $ org ^.. traverseTree . orgClocks- in (minimum (map cFrom c), maximum (map cTo c))+ in (L.minimum (map cFrom c), L.maximum (map cTo c)) -- period to show. Right border is -1min, we assume it's non-inclusive daysToShow = [localDay from ..