git.fiddlerwoaroof.com
Browse code

Add a main function to freshbooks integration

- Add main function to freshbooks integration.
- Adjust main-function to use the new objects for the log entries
- Add a DURATION method for partial entries that emits a warning
and returns 0
- Fix the README

fiddlerwoaroof authored on 28/02/2016 03:03:03
Showing 2 changed files
... ...
@@ -4,11 +4,11 @@ The file-format is this:
4 4
 
5 5
 ```
6 6
 -- Someday YYYY-MM-DD
7
-   start@HH:MM[:SS][+-NN(mins|hrs)][,HH:MM[:SS][+-NN(mins|hrs)]]
7
+   start@HH:MM[:SS][(+|-)NN(mins|hrs)][,HH:MM[:SS][(+|-)NN(mins|hrs)]]
8 8
    Client Name: This is a memo.	
9 9
 ```
10 10
 
11
-Write now the parser is fairly fragile: it reds what it can and fails silently at the first 
11
+Right now the parser is fairly fragile: it reads what it can and fails silently at the first 
12 12
 error.  Eventually there'll be better error-handling.
13 13
 
14 14
 ```
... ...
@@ -20,6 +20,8 @@ timesheet, common-lisp version 0:1
20 20
   -h --help                       boolean  show help
21 21
 ```
22 22
 
23
+By default, it orders the log by dates.  With the `-r` option, it displays the dates in descending order:
24
+
23 25
 ```
24 26
 % ./timesheet -r sample-inputs/test.ts
25 27
 Thu, 2016/01/04  Client #2    5.00 hrs  Implement prototype and write presentation
... ...
@@ -30,6 +32,8 @@ Tue, 2016/01/02  Client #1    8.00 hrs  Prototype for testing user experience.
30 32
 Mon, 2016/01/01  Client #1    8.00 hrs  Mockup of site layout
31 33
 ```
32 34
 
35
+With `-c` it sorts by clients and then does a stable-sort by date:
36
+
33 37
 ```
34 38
 % ./timesheet -sc sample-inputs/test.ts
35 39
 Mon, 2016/01/01  Client #1    8.00 hrs  Mockup of site layout
... ...
@@ -39,9 +43,9 @@ Thu, 2016/01/04  Client #1    9.00 hrs  Implement Facebook Connector
39 43
 Wed, 2016/01/03  Client #2    2.50 hrs  Discussed user requirements and produce specification.
40 44
 Thu, 2016/01/04  Client #2    5.00 hrs  Implement prototype and write presentation
41 45
 ------------------------------------------------------------------------------------------------------------------------
42
-                 Client #1:  31.00 hours @   40.00 $/hr = $1240.00
43
-                 Client #2:   7.50 hours @   40.00 $/hr = $ 300.00
44
-                     Total:  38.50 hours @   40.00 $/hr = $1540.00
46
+                 Client #1:  31.00 hours @   XX.00 $/hr = $XXXX.00
47
+                 Client #2:   7.50 hours @   XX.00 $/hr = $ XXX.00
48
+                     Total:  38.50 hours @   XX.00 $/hr = $XXXX.00
45 49
 ```
46 50
 
47 51
 ```
... ...
@@ -53,11 +57,13 @@ Wed, 2016/01/03  Client #1    6.00 hrs  Delivered prototype, reviewed prototype
53 57
 Tue, 2016/01/02  Client #1    8.00 hrs  Prototype for testing user experience.
54 58
 Mon, 2016/01/01  Client #1    8.00 hrs  Mockup of site layout
55 59
 ------------------------------------------------------------------------------------------------------------------------
56
-                 Client #1:  31.00 hours @   40.00 $/hr = $1240.00
57
-                 Client #2:   7.50 hours @   40.00 $/hr = $ 300.00
58
-                     Total:  38.50 hours @   40.00 $/hr = $1540.00
60
+                 Client #1:  31.00 hours @   XX.00 $/hr = $XXXX.00
61
+                 Client #2:   7.50 hours @   XX.00 $/hr = $ XXX.00
62
+                     Total:  38.50 hours @   XX.00 $/hr = $XXXX.00
59 63
 ```
60 64
 
65
+`-c` and `-r` combine:
66
+
61 67
 ```
62 68
 % ./timesheet -scr sample-inputs/test.ts
63 69
 Thu, 2016/01/04  Client #2    5.00 hrs  Implement prototype and write presentation
... ...
@@ -67,8 +73,8 @@ Wed, 2016/01/03  Client #1    6.00 hrs  Delivered prototype, reviewed prototype
67 73
 Tue, 2016/01/02  Client #1    8.00 hrs  Prototype for testing user experience.
68 74
 Mon, 2016/01/01  Client #1    8.00 hrs  Mockup of site layout
69 75
 ------------------------------------------------------------------------------------------------------------------------
70
-                 Client #1:  31.00 hours @   40.00 $/hr = $1240.00
71
-                 Client #2:   7.50 hours @   40.00 $/hr = $ 300.00
72
-                     Total:  38.50 hours @   40.00 $/hr = $1540.00
76
+                 Client #1:  31.00 hours @   XX.00 $/hr = $XXXX.00
77
+                 Client #2:   7.50 hours @   XX.00 $/hr = $ XXX.00
78
+                     Total:  38.50 hours @   XX.00 $/hr = $XXXX.00
73 79
 ```
74 80
 
... ...
@@ -69,16 +69,16 @@
69 69
   tasks staff)
70 70
 
71 71
 (timesheet.macros:define-printer (task s)
72
-                                 ((with-slots (task_id name) task
73
-                                    (format s "~i~a (~a):" name task_id)))
74
-                                 ((with-slots (task_id name) task
75
-                                    (format s "~a (~a)" name task_id))))
72
+  ((with-slots (task_id name) task
73
+    (format s "~i~a (~a):" name task_id)))
74
+  ((with-slots (task_id name) task
75
+    (format s "~a (~a)" name task_id))))
76 76
 
77 77
 (timesheet.macros:define-printer (project s)
78
-                                 ((with-slots (project_id name tasks) project
79
-                                    (format s "~i~a (~a):~%~{~a~%~}" name project_id tasks)))
80
-                                 ((with-slots (project_id name tasks) project
81
-                                    (format s "~a (~a): ~a tasks" name project_id (length tasks)))))
78
+  ((with-slots (project_id name tasks) project
79
+    (format s "~i~a (~a):~%~{~a~%~}" name project_id tasks)))
80
+  ((with-slots (project_id name tasks) project
81
+    (format s "~a (~a): ~a tasks" name project_id (length tasks)))))
82 82
 
83 83
 (defparameter *task-registry* (make-hash-table :test 'equal))
84 84
 (defmethod initialize-instance :after ((self task) &key &allow-other-keys)