arbtt 0.8 → 0.8.1
raw patch · 5 files changed
+36/−15 lines, 5 filesdep ~tastydep ~tasty-goldendep ~tasty-hunit
Dependency ranges changed: tasty, tasty-golden, tasty-hunit
Files
- arbtt.cabal +5/−5
- doc/arbtt.xml +16/−4
- src/Categorize.hs +3/−6
- tests/issue14.cfg +2/−0
- tests/test.hs +10/−0
arbtt.cabal view
@@ -1,5 +1,5 @@ name: arbtt-version: 0.8+version: 0.8.1 license: GPL license-file: LICENSE category: Desktop@@ -16,7 +16,7 @@ expressive rules you specify, derive what you were doing, and what for. . The documentation, which includes the changelog, can also be found at- http://arbtt.nomeata.de/doc/users_guide/.+ <http://arbtt.nomeata.de/doc/users_guide/>. . WARNING: The log file might contain very sensitive private data. Make sure you understand the consequences of a full-time logger and be careful with this@@ -191,9 +191,9 @@ test.hs Build-depends: base == 4.5.* || == 4.6.* || == 4.7.*- , tasty == 0.7.*- , tasty-golden == 2.2.0.2- , tasty-hunit == 0.2.* || == 0.4.*+ , tasty == 0.7.* || == 0.8.*+ , tasty-golden >= 2.2.0.2 && <= 2.3+ , tasty-hunit == 0.2.* || == 0.4.* || == 0.8.* , HUnit == 1.2.* , process-extras == 0.2.* , deepseq
doc/arbtt.xml view
@@ -425,7 +425,7 @@ <rhs> <quote>$time</quote> </rhs> <rhs> <quote>$sampleage</quote> </rhs> <!-- <rhs> <nonterminal def="#g-date"/> <quote>-</quote> <nonterminal def="#g-date"/></rhs> -->- <rhs>[ Digit ] Digit <quote>:</quote> Digit Digit</rhs>+ <rhs>( Digit )* Digit <quote>:</quote> Digit Digit</rhs> </production> <production id="g-tag">@@ -1178,9 +1178,21 @@ <para> The version history with changes relevant for the user is documented here. </para>- - <sect2>- <title>Version 0.8 (unreleased)</title>++ <sect2 id="release-notes-0.8">+ <title>Version 0.8.1</title>+ <itemizedlist>+ <listitem>+ <para>+ The syntax now allows for time differences larger than 99:99.+ (<ulink url="https://bitbucket.org/nomeata/arbtt/issue/14/improve-time-categorization-directives">issue #14</ulink>)+ </para>+ </listitem>+ </itemizedlist>+ </sect2>++ <sect2 id="release-notes-0.8">+ <title>Version 0.8</title> <itemizedlist> <listitem> <para>
src/Categorize.hs view
@@ -433,13 +433,10 @@ -- | Parses a day-of-time specification (hh:mm) parseTime :: Parser NominalDiffTime parseTime = fmap fromIntegral $ lexeme lang $ do- h <- digitToInt <$> digit- mh <- optionMaybe (digitToInt <$> digit)+ hour <- read <$> many1 digit char ':'- m1 <- digitToInt <$> digit- m2 <- digitToInt <$> digit- let hour = maybe h ((10*h)+) mh- return $ (hour * 60 + m1 * 10 + m2) * 60+ minute <- read <$> count 2 digit+ return $ (hour * 60 + minute) * 60 parseDate :: Parser UTCTime parseDate = lexeme lang $ do
+ tests/issue14.cfg view
@@ -0,0 +1,2 @@+$sampleage > 100:00 ==> tag old,+$sampleage < 100:00 ==> tag new
tests/test.hs view
@@ -16,6 +16,7 @@ import Categorize import TimeLog import Data+import Data.Time.Clock main = do putEnv "TZ=UTC" -- to make tests reproducible@@ -37,6 +38,15 @@ let sample = TimeLogEntry undefined 0 (CaptureData [(True, "aa", "program")] 0 "") let [TimeLogEntry _ _ (_,acts)] = cat [sample] [Activity Nothing "A2"] @=? acts+ return ()+ , testCase "Issue #14" $ do+ cat <- readCategorizer "tests/issue14.cfg"+ now <- getCurrentTime+ let backThen = (-60*60*101) `addUTCTime` now++ let sample = TimeLogEntry backThen 0 (CaptureData [(True, "aa", "program")] 0 "")+ let [TimeLogEntry _ _ (_,acts)] = cat [sample]+ [Activity Nothing "old"] @=? acts return () ]