packages feed

casr-logbook 0.6.7 → 0.6.8

raw patch · 4 files changed

+34/−35 lines, 4 files

Files

casr-logbook.cabal view
@@ -1,5 +1,5 @@ name:               casr-logbook-version:            0.6.7+version:            0.6.8 license:            OtherLicense license-file:       LICENSE author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
changelog view
@@ -1,3 +1,7 @@+0.6.8++* Include instructing in command total hours+ 0.6.7  * Add solo approval
src/Data/Aviation/Casr/Logbook/Reports/FlightTimeReport.hs view
@@ -10,26 +10,6 @@ import Control.Category((.)) import Control.Lens ( preview, (^.), view, isn't, makeClassy ) import Data.Aviation.Casr.Logbook.Types-    ( TimeAmount,-      AsEngine(_Multi, _Single),-      Aviator,-      HasAircraft(aircraftRegistration, aircraftType, aircraftEngine),-      HasDayNight(nightDayNight, dayDayNight),-      totalDayNight,-      AsCommand(_InCommandInstructing, _InCommand, _Dual, _ICUS),-      HasAircraftFlight(instrumentflightTime, daynight, flightaircraft,-                        command),-      Entry(AircraftFlightEntry),-      Entries(Entries),-      Logbook(Logbook),-      HasInstructionRating(instructionRating),-      AsInstructionRating(_GA3InstructionRating, _GA2InstructionRating,-                          _GA1InstructionRating, _RASIInstructionRating,-                          _RAInstructionRating),-      getUnderInstructionPic,-      isRAInstruction,-      isGAInstruction,-      aeronauticalHours ) import Data.Eq(Eq) import Data.Foldable(foldl') import Data.Int(Int)@@ -208,7 +188,7 @@           Nothing ->             mempty       comd x =-        case preview (command . _InCommand) fl of+        case preview (command . _InCommandIncludingInstructing) fl of           Just _ ->             x           Nothing ->
src/Data/Aviation/Casr/Logbook/Types/Command.hs view
@@ -1,17 +1,22 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE LambdaCase #-}  module Data.Aviation.Casr.Logbook.Types.Command(   Command(..) , AsCommand(..) , getUnderInstructionPic , isAeronauticalHours+, _InCommandIncludingInstructing ) where -import Control.Lens(makeClassyPrisms)+import Control.Applicative+    ( Applicative((*>)), Alternative((<|>)) )+import Control.Lens+    ( Prism', preview, makeClassyPrisms, isn't, prism', (#) ) import Data.Aviation.Casr.Logbook.Types.Aviator(Aviator) import Data.Aviation.Casr.Logbook.Types.Instruction ( Instruction )-import Data.Bool ( Bool(..) )+import Data.Bool ( Bool(..), not ) import Data.Eq(Eq) import Data.Maybe(Maybe(Just, Nothing)) import Data.Ord(Ord)@@ -42,15 +47,25 @@   Nothing  isAeronauticalHours ::-  Command+  AsCommand c =>+  c   -> Bool-isAeronauticalHours (ICUS _) =-  True-isAeronauticalHours (Dual _) =-  True-isAeronauticalHours InCommand =-  True-isAeronauticalHours (InCommandInstructing _) =-  True-isAeronauticalHours (ApprovedSolo _) =-  False+isAeronauticalHours c =+  not (isn't _ApprovedSolo c)++_InCommandIncludingInstructing ::+  AsCommand c =>+  Prism' c (Maybe Instruction)+_InCommandIncludingInstructing =+  prism'+    (\case+      Nothing ->+        _InCommand # ()+      Just i ->+        _InCommandInstructing # i+    )+    (+      \c ->+        preview _InCommand c *> Nothing <|>+        preview _InCommandIncludingInstructing c+    )