Ver Fonte

Foursquare cron

Innocenty Enikeew há 11 anos atrás
pai
commit
f9c49ea698
3 ficheiros alterados com 10 adições e 7 exclusões
  1. 3 4
      src/financisto.lisp
  2. 4 2
      src/web.lisp
  3. 3 1
      timeliner.asd

+ 3 - 4
src/financisto.lisp

@@ -141,9 +141,8 @@
           (kv "note" (getf e :note))
           financisto)))))
 
-(defun import-financisto-events ()
-  (let* ((filename (find-last-backup))
-         (db (load-backup filename))
+(defun import-financisto-events (filename)
+  (let* ((db (load-backup filename))
          (transactions (sort (loop for entity being the hash-values of (gethash "transactions" db)
                                 when (not (string= (getf entity :category-id) "-1"))
                                 collect entity)
@@ -181,4 +180,4 @@
               (db.insert "events" new-doc)))))))
 
 (defun on-cron ()
-  (import-financisto-events))
+  (import-financisto-events (find-last-backup)))

+ 4 - 2
src/web.lisp

@@ -15,7 +15,8 @@
 (defvar *run-cron* t "Controls if starting a web should run cron tasks")
 (defvar *crons* (list
                  (list #'timeliner.locations:on-cron '(:minute 0 :hour *))
-                 (list #'timeliner.financisto:on-cron '(:minute 0 :hour 7)))
+                 (list #'timeliner.financisto:on-cron '(:minute 0 :hour 7))
+                 (list #'timeliner.foursquare:on-cron '(:minute 5 :hour *)))
   "List of cron functions with their schedules")
 (defvar *cron-timers* nil)
 
@@ -347,7 +348,8 @@
                icon-class (lambda ()
                             (case (! this model (get :type))
                               (:place "glyphicon glyphicon-map-marker")
-                              (:finance "glyphicon glyphicon-usd")))
+                              (:finance "glyphicon glyphicon-usd")
+                              (:checkin "glyphicon glyphicon-ok-circle")))
                render (lambda ()
                         (! this $el (attr (create
                                            :href "#"

+ 3 - 1
timeliner.asd

@@ -54,9 +54,11 @@ THE SOFTWARE.
                 ((:file "utils")
                  (:file "locations" :depends-on ("utils"))
                  (:file "financisto" :depends-on ("utils"))
+                 (:file "foursquare" :depends-on ("utils"))
                  (:file "web" :depends-on ("utils"
                                            "locations"
-                                           "financisto")))))
+                                           "financisto"
+                                           "foursquare")))))
   :description "Personal Timeline"
   :long-description
   #.(with-open-file (stream (merge-pathnames