casr-logbook 0.0.3 → 0.0.4
raw patch · 4 files changed
+15/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Aviation.Casr.Logbook.Hours: fractionalHours :: Fractional a => Hours -> a
Files
- casr-logbook.cabal +1/−1
- changelog +4/−0
- src/Data/Aviation/Casr/Logbook/Hours.hs +8/−0
- src/Data/Aviation/Casr/Logbook/Totals.hs +2/−1
casr-logbook.cabal view
@@ -1,5 +1,5 @@ name: casr-logbook-version: 0.0.3+version: 0.0.4 license: OtherLicense license-file: LICENSE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
changelog view
@@ -1,3 +1,7 @@+0.0.4++* Add percentages to totals.+ 0.0.3 * Fix bug in merging two totals.
src/Data/Aviation/Casr/Logbook/Hours.hs view
@@ -2,6 +2,7 @@ Hours(..) , zeroHours , addHours+, fractionalHours ) where import Data.Aviation.Casr.Logbook.Printer.Markdown@@ -35,3 +36,10 @@ instance Markdown Hours where markdown (Hours t p) = "* Hours: **`" ++ show t ++ "." ++ show p ++ "`**\n"++fractionalHours ::+ Fractional a =>+ Hours+ -> a+fractionalHours (Hours f p) =+ fromIntegral f + (fromIntegral p / 10)
src/Data/Aviation/Casr/Logbook/Totals.hs view
@@ -18,6 +18,7 @@ import Data.Foldable(foldl') import Data.Map(Map) import qualified Data.Map as Map+import Text.Printf data Totals = Totals@@ -58,7 +59,7 @@ displayPoint x h = "* " ++ x ++ ": **`" ++ displayHours h ++ "`**\n" displayMap x m =- "* " ++ x ++ "\n" ++ Map.foldrWithKey (\k h s -> " * " ++ k ++ ": **`" ++ displayHours h ++ "`**\n" ++ s) "" m+ "* " ++ x ++ "\n" ++ Map.foldrWithKey (\k h s -> " * " ++ k ++ ": **`" ++ displayHours h ++ " (" ++ printf "%.2f" (fractionalHours h / fractionalHours total * 100 :: Double) ++ "%)`**\n" ++ s) "" m in concat [ "##### Summary\n"