packages feed

Villefort 0.1.0.6 → 0.1.0.7

raw patch · 7 files changed

+34/−35 lines, 7 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Database: path' :: IO FilePath
+ Todo: fromZonedTimeToDay :: [Char] -> Day

Files

README.md view
@@ -1,9 +1,20 @@ # Villefort
-Villefort is a time managment system written in Haskell and backed by sqlite.
-#Home screen
+Villefort is a time managment system written in Haskell.
+
+## What's new in version Villefort-0.1.0.7
+- Sqlite database now saves events using localtime.
+- Days until due is now calculated using localtime.
+- Tracks when you update working time on todo instead of just when you finish your task.
+# Home screen
 ![alt text](https://raw.githubusercontent.com/Chrisr850/Villefort/master/data/screen.png)
-# Villefort has page to add new todos
+# Add new todos
 ![alt text](https://raw.githubusercontent.com/Chrisr850/Villefort/master/data/screen01.png)
-# Villefort also has a stats page which shows how much time you spend on each subject. It also includes a github like time tracker
+# Stats page 
 
 ![alt text](https://raw.githubusercontent.com/Chrisr850/Villefort/master/data/screen02.png)
+
+# To install 
+1. Install cabal (https://www.haskell.org/platform/)
+2. In terminal or command prompt run `cabal install Villefort`.
+3. and then `cabal run Villefort`.
+4. You will be able to see the homescreen by typing localhost:3002 into your favorite browser.
Villefort.cabal view
@@ -1,7 +1,7 @@ name:                Villefort-version:             0.1.0.6+version:             0.1.0.7 synopsis: Villefort is a task manager and time tracker written in haskell.-description: Villefort is powered by a sqlite+description: Villefort is a browser based time tracker. homepage:            https://github.com/Chrisr850/Villefort#readme license:             BSD3 license-file:        LICENSE
app/Main.hs view
@@ -17,23 +17,25 @@   -getDone = makeQuery  "select Title, time  from todo where due = Date('now','+1 day') and state = 0" +getDone = makeQuery  "select Title, time  from todo where due = Date('now','localtime') and state = 0"   getWeeks = do   raw <- makeQuery "select id, Title from weeks where state = 1 order by Title"   return $ Prelude.mapM (\x -> [Prelude.head x ,( Prelude.tail (Prelude.last x))]) raw + getIndex :: [[Char]] -> Int -> [Char] getIndex str i = (Data.List.Split.splitOn "=" (str !! i)) !! 1  +-- | Converts date from Javascript to sqlite date fromat  convDate :: String -> String convDate date = newDate         where split = Data.List.Split.splitOn "%2F" date               newDate = (split !! 2) ++ "-" ++ (split !! 0) ++ "-" ++ (split !! 1)  -+-- | makes html for radiobutton makeRadio x =  "<dd><input type='radio' name='subject' value='"++ x ++ "'> " ++ x ++ "</br> \n"   @@ -45,7 +47,7 @@   let radiobuttons = map makeRadio subjects   return ((split !! 0) ++ (concat radiobuttons) ++ (split !! 1))  -  +-- | Main function of loop main :: IO () main = do   scotty 3002 $ do
data/todo.db view

binary file changed (12288 → 12288 bytes)

src/Database.hs view
@@ -22,9 +22,10 @@ path =fmap (\x -> (x !! 0) ++ "Villefort/") $  (Data.List.Split.splitOn "Villefort/") <$> getProgPath --path = getDataDir +path' = getDataDir  getDb :: IO Connection  -getDb =  getDataFileName "data/todo.db" >>= connectSqlite3 +getDb =  (++ "data/todo.db") <$> path >>= \path ->   putStrLn path >> connectSqlite3 path  conv :: [[SqlValue]] -> [[String]] conv dat = Prelude.map (\x -> Prelude.map (\y -> fromSql y :: String) x) dat
src/Todo.hs view
@@ -4,6 +4,7 @@ import Data.List.Split import Control.Monad.IO.Class import Data.Time+import Data.List.Split as S import Paths_Villefort  @@ -17,7 +18,7 @@ toRow :: [String] -> Row toRow x = Row (read (x !! 0) :: Int) (x !! 1) (x !! 2) (x !! 3) (read( x !! 4) :: Int) -qetTasks' =  makeQuery "select id, Title, Description, Due, time from todo where state = 1 order by Due" >>=+qetTasks' =  makeQuery " select id, Title, Description, Due, sum(time) from todo where state = 1 group by Title, Description order by Due " >>=   \x -> return (map toRow x)  @@ -82,10 +83,13 @@   c <- getCurrentTime   let (y,m,d) = toGregorian $ utctDay c   let split = Data.List.Split.splitOn "-" date-  let current = fromGregorian y m d+  current <- fromZonedTimeToDay <$> show <$> getZonedTime   let due     = fromGregorian (read (split !! 0) :: Integer) (read (split !! 1) :: Int) (read (split !! 2) :: Int)-  return $ (diffDays  due current) -1+  return $ (diffDays  due current)  +fromZonedTimeToDay x = fromGregorian (read (nums !! 0) :: Integer) (read (nums !! 1) :: Int) (read (nums !! 2) :: Int) +  where nums = S.splitOn "-" $  take 10 x+    getTodos = do   tasks <-  qetTasks'@@ -114,4 +118,6 @@ delTask id = execQuery "update todo  set state = 0 where id = ?" [id]  updateTask :: Int -> Int ->  IO ()-updateTask id time = execQuery "update todo set time = time + ? where id = ?" [ time, id]+updateTask id time = execQuery "insert into todo (Description,Title,Entered,Due,state,time,Subject) select Description,Title,Entered,Due,0,time+?,Subject from todo where id = ?" [ time, id]++
− templates/test.html
@@ -1,21 +0,0 @@-<!DOCTYPE html>-<html>-  <script-  src="https://code.jquery.com/jquery-1.10.2.min.js"-  integrity="sha256-C6CB9UYIS9UJeqinPHWTHVqh/E1uhG5Twh+Y5qFQmYg="-    crossorigin="anonymous"></script>- -  <input type="radio" class="what"value="Hellow"> New Subject </br>-  <textarea id="textarea"></textarea>-  -   <script>-    var oldVal = "";-$("#textarea").on("change keyup paste", function() {-    //action to be performed on textarea changed-   // alert("changed!");-    var text = $("#textarea").val();-    $(".what").val(text);--});-  </script>-</html>