adding ignore.
This commit is contained in:
51
src/clj/user.clj
Normal file
51
src/clj/user.clj
Normal file
@@ -0,0 +1,51 @@
|
||||
(ns user
|
||||
(:require [auto-ap.datomic :refer [uri]]
|
||||
[datomic.api :as d]
|
||||
|
||||
[clj-time.coerce :as c]
|
||||
[clj-time.core :as t]))
|
||||
|
||||
(defn exclude-until-date [client end]
|
||||
(let [conn (d/connect uri)]
|
||||
(doseq [p (->>
|
||||
(d/query {:query {:find '[?e]
|
||||
:in '[$ ?client ?end ]
|
||||
:where [
|
||||
'[?e :invoice/client ?c]
|
||||
'[?c :client/code ?client]
|
||||
'[?e :invoice/date ?d ]
|
||||
'[(<= ?d ?end) ]]}
|
||||
:args [(d/db conn)
|
||||
client
|
||||
(c/to-date end)]})
|
||||
(mapv first)
|
||||
(mapv (fn [i]
|
||||
{:db/id i
|
||||
:invoice/exclude-from-ledger true}))
|
||||
(partition-all 100))]
|
||||
|
||||
@(d/transact conn p)
|
||||
(println "process 100"))
|
||||
|
||||
(doseq [p (->>
|
||||
(d/query {:query {:find '[?e]
|
||||
:in '[$ ?client ?end ]
|
||||
:where [
|
||||
'[?e :transaction/client ?c]
|
||||
'[?c :client/code ?client]
|
||||
'[?e :transaction/date ?d ]
|
||||
'[(<= ?d ?end) ]]}
|
||||
:args [(d/db conn)
|
||||
client
|
||||
(c/to-date end)]})
|
||||
(mapv first)
|
||||
(mapv (fn [i]
|
||||
{:db/id i
|
||||
:transaction/approval-status :transaction-approval-status/excluded}))
|
||||
(partition-all 100))]
|
||||
|
||||
@(d/transact conn p)
|
||||
(println "process 100"))))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user