Initial impl of depreciation function.

[?]
Mar 26, 2014, 1:54 AM
A2J7B4SCCJYKQV3G2LDHEFNE2GUICO3N3Y5FKF4EUZW5AG7PTDWAC

Dependencies

  • [2] P6NR2CGX Beginning of implementation of depreciation.
  • [3] N4NDAZYT Initial implementation of payouts.
  • [4] Y35QCWYW Minor improvement in WorkIndex type to eliminate duplicated information.
  • [*] NVOCQVAS Initial failing tests.
  • [*] 7DBNV3GV Initial, stack-based impl of time log event reduction.

Change contents

  • edit in src/Ananke/TimeLog.hs at line 20
    [7.119]
    [6.1028]
    import Data.Ratio
  • edit in src/Ananke/TimeLog.hs at line 107
    [3.970]
    [3.970]
    newtype Months = Months Integer
    monthsLength :: Months -> NominalDiffTime
    monthsLength (Months i) = fromInteger $ 60 * 60 * 24 * 30 * i
    linearDepreciation :: Months -> Months -> Depreciation
    linearDepreciation undepPeriod depPeriod =
    let maxDepreciable :: NominalDiffTime
    maxDepreciable = monthsLength undepPeriod + monthsLength depPeriod
  • replacement in src/Ananke/TimeLog.hs at line 118
    [3.971][2.49:149]()
    linearDepreciation :: Depreciation
    linearDepreciation =
    let depf = undefined
    Depreciation depf
    [3.971]
    zeroTime :: NominalDiffTime
    zeroTime = fromInteger 0
    depf :: NominalDiffTime -> Rational
    depf dt = if dt < monthsLength undepPeriod
    then 1
    else toRational (max zeroTime (maxDepreciable - dt)) / toRational maxDepreciable
    in Depreciation depf