packages feed

Villefort 0.1.2.10 → 0.1.2.11

raw patch · 13 files changed

+47/−34 lines, 13 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Villefort.Weekly: firstSecond :: [[String]] -> [[String]]
- Villefort.Weekly: fromZonedTimeToDay :: String -> Day
- Villefort.Weekly: genTabs :: (MonadReader VConfig m, MonadIO m) => m String
- Villefort.Weekly: getDate :: IO Day
- Villefort.Weekly: getDatesOfPrevWeek :: IO [Day]
- Villefort.Weekly: getDatesOfThisWeek :: IO [Day]
- Villefort.Weekly: getDatesOfWeek :: IO [Day]
- Villefort.Weekly: getDay :: IO Int
- Villefort.Weekly: getDoneDay :: (MonadReader VConfig m, MonadIO m) => String -> m [[String]]
- Villefort.Weekly: getPrevWeek :: (MonadReader VConfig m, MonadIO m) => m [[String]]
- Villefort.Weekly: getStartOfWeek :: IO Day
- Villefort.Weekly: getSubWeek :: (MonadReader VConfig m, MonadIO m) => String -> String -> m [[String]]
- Villefort.Weekly: getSummaryDay :: (MonadReader VConfig m, MonadIO m) => Day -> m String
- Villefort.Weekly: getThisWeek :: (MonadReader VConfig m, MonadIO m) => m [[String]]
- Villefort.Weekly: merge1 :: [a] -> [a] -> [a]
- Villefort.Weekly: selectNum :: Bool -> (String, [String]) -> [String]
- Villefort.Weekly: spec1 :: [[String]] -> [[String]] -> [[String]]
- Villefort.Weekly: zipWithPadding :: a -> b -> [a] -> [b] -> [(a, b)]
- Villefort.Daily: readDate :: IO D
+ Villefort.Daily: readDate :: (MonadReader VConfig m, MonadIO m) => m D
- Villefort.Daily: readDay :: IO Int
+ Villefort.Daily: readDay :: (MonadReader VConfig m, MonadIO m) => m Int
- Villefort.Daily: writeDate :: IO ()
+ Villefort.Daily: writeDate :: (MonadReader VConfig m, MonadIO m) => m ()
- Villefort.Daily: writeDay :: IO ()
+ Villefort.Daily: writeDay :: (MonadReader VConfig m, MonadIO m) => m ()
- Villefort.Database: clean :: [Char] -> [Char]
+ Villefort.Database: clean :: () => a -> a

Files

Main.hs view
@@ -5,4 +5,4 @@ import Villefort.Config  main :: IO ()-main = villefort def +main = villefort def
README.md view
@@ -1,9 +1,8 @@ # Villefort
 Villefort is a time managment system written in Haskell.
 
-## Version 1.2.10
-- Fixed bug in collecting the time spent on project.
-- Removed unecessary print statements.
+## Version 1.2.11
+- Integrated date and day tracking into database to stop file corruption.
 
 [default config](https://github.com/Chrisr850/Villefort/blob/master/src/Villefort/Config.hs)
 
Villefort.cabal view
@@ -1,7 +1,7 @@ name:                Villefort-version:             0.1.2.10-synopsis: Villefort is a task manager and time tracker written in haskell.-description: Villefort is a browser based time tracker. It offers the creation of weekly and daily triggered tasks. It also offers stats on both daily, weekly and total time spent on tasks.+version:             0.1.2.11+synopsis: Villefort is a task manager and time tracker+description: Villefort is a browser based time tracker built around a sqlite3 database. homepage:            https://github.com/Chrisr850/Villefort#readme license:             BSD3 license-file:        LICENSE@@ -13,9 +13,7 @@ extra-source-files:  README.md cabal-version:       >=1.10 		    -data-files:            data/date-		     , data/todo.db-                     , data/day+data-files:            data/todo.db                      , templates/*.html                      , templates/*.ts                      , templates/header
− data/date
@@ -1,1 +0,0 @@-2018-01-03
− data/day
@@ -1,1 +0,0 @@-3
data/todo.db view

binary file changed (122880 → 122880 bytes)

src/Villefort/Daily.hs view
@@ -36,30 +36,42 @@   z <- getDate   return $ snd $mondayStartWeek z ++writeDate :: (MonadReader VConfig m, MonadIO m) => m ()+writeDate = do+  date <- liftIO $ show <$> getDate+  execQuery ("update dates set  date = ? where type = 'date';") [date]++readDate :: (MonadReader VConfig m, MonadIO m) => m D+readDate = do+  rawDate <- makeQuery "select date from dates where type = 'date';"+  return $ unpackStringToDate $ head $ head $ rawDate++{- writeDate :: IO () writeDate = do   date <-  show <$> getDate   datePath <- getDataFileName "data/date"   writeFile datePath date + readDate :: IO D readDate = do   datePath <- getDataFileName "data/date"   rawDate <-  S.readFile datePath   let date = unpackStringToDate rawDate   return date+-} -writeDay :: IO ()+writeDay :: (MonadReader VConfig m, MonadIO m) => m () writeDay = do-  newDay <- show <$> getDay-  datePath <- getDataFileName "data/day"-  writeFile datePath newDay--readDay :: IO Int+  newDay <- liftIO $ show <$> getDay+  execQuery ("update dates set  date = ? where type = 'day';") [newDay]+  +readDay :: (MonadReader VConfig m, MonadIO m) => m Int readDay = do-  datePath <- getDataFileName "data/day"-  rawDay <- S.readFile datePath-  let int = read rawDay :: Int+  rawDay <- makeQuery "select date from dates where type = 'day';"+  let int = read (head $ head $ rawDay) :: Int   return int    checkDay :: D -> D ->Bool@@ -120,14 +132,14 @@ --man :: IO () man :: VConfig -> IO () man conf = do-  oldDate <- readDate+  oldDate <- runReaderT readDate conf   currentDate <- getDateD-  oldDay <- readDay+  oldDay <- runReaderT readDay conf   currentDay <- getDay   runWeekly conf oldDay currentDay   runDaily conf oldDate currentDate-  writeDate-  writeDay+  runReaderT writeDate conf+  runReaderT writeDay conf   threadDelay 18000000    dailyCheck :: VConfig -> IO b
src/Villefort/Database.hs view
@@ -107,5 +107,5 @@ --getSum :: IO (Maybe [String])  -clean = replace "'" "''"+clean = id --replace "'" "''"  
src/Villefort/Log.hs view
@@ -35,7 +35,7 @@  -- | creates the github like graph from database -makeGithub ::(MonadReader VConfig m, MonadIO m) =>  String ->  m Subject+--makeGithub ::(MonadReader VConfig m, MonadIO m) =>  String ->  m Subject makeGithub subject = do   z <-   makeQuery ("select substr(Due,1,10) from todo where subject = '" ++ (clean subject) ++ "' and state = 0")    color <- liftIO $  getColor 
src/Villefort/Server.hs view
@@ -61,7 +61,6 @@ checkCustomBuild = do   dir <- getAppUserDataDirectory "villefort"   let path = dir ++ "/villefort"-  putStrLn path   isBuild <- doesFileExist path   dataDir <- getDataDir   if isBuild@@ -89,9 +88,11 @@     post "/update" $ do       rawHtml <- body       let da   = Data.List.Split.splitOn "&" (show rawHtml)+      do liftIO $ print $ show da       let rawid = Data.List.Split.splitOn "=" $  (Prelude.init (da !! 1))       let sqlId   = read (rawid!! 1) :: Int       let rawtime = Data.List.Split.splitOn "=" $ (da !! 0)+      do liftIO $ print rawtime       let insertTime = read (rawtime !! 1) :: Int       liftIO $ runReaderT (updateTodos sqlId insertTime) conf       redirect "/"@@ -99,6 +100,7 @@     post "/add" $ do       rawBody <-body       let parse = Data.List.Split.splitOn "&" (show rawBody)+      do liftIO $ print parse       -- !@#$%^&*()_+       let rep  =  replace "+" " " . replace "%21" "!" . replace "%40" "@" . replace "%23" "#" . replace "%24" "$" . replace "%25" "%" . replace "%5E" "^" . replace "%26" "&" . replace "%28" "(" . replace "%29" ")" . replace "%2B" "+"       let summary = rep $ getIndex parse 0
src/Villefort/Todo.hs view
@@ -55,7 +55,9 @@   x <- makeQuery' "select id, Title, Description, Due, Subject, pred from todo where state=1 group by id order by Due"   let ids =  map head x   times <- mapM getTime ids+  liftIO $ print $ length times   let halfRows = (map toRow x) :: [Int -> Double -> Row]+  liftIO $ print $ length halfRows   let z =  apply halfRows times   return $ apply z [0,0 .. 1] -- | applies a list of functions to a list of values@@ -100,6 +102,7 @@             title row,             description row,             show $ time row,+            show $ Villefort.Todo.pred row,             "/delete",             show $ rid row            ]
src/Villefort/Weekly.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE FlexibleContexts #-}-module Villefort.Weekly  where+module Villefort.Weekly (weeklyStats) where  import Control.Monad.Reader import Villefort.Definitions@@ -38,13 +38,13 @@   return $ addDays (-currentDay) today  fromZonedTimeToDay :: String -> Day-fromZonedTimeToDay x = fromGregorian (read (split !! 0) :: Integer) (read (split !! 1) :: Int) (read (take 2 (split !! 2)) :: Int)+fromZonedTimeToDay x = fromGregorian ( y split 0) (md split 1) (md split 2)   where split = S.splitOn "-" x+        md splits x = read ( splits !! x) :: Int+        y     splits x = read ( splits !! x ) :: Integer+ getDate :: IO Day-getDate = do-  a <- getZonedTime-  let z = show a-  return $ fromZonedTimeToDay z +getDate = fromZonedTimeToDay <$> show <$> getZonedTime  getDay :: IO Int getDay = do
templates/modal.ts view
@@ -15,6 +15,7 @@           <p> } </p> 	   	  <p> Total minutes spent working on Project } </p>+	  <p> Predicted time } </p>         </div>         <div class="modal-footer"> 	<form class="pull-left" action="}" method="post" class="add-entry">