lots of new features.

This commit is contained in:
Bryce Covert
2020-05-30 10:31:46 -07:00
parent d9bf9867e4
commit 3101dd1fe6
11 changed files with 61 additions and 23 deletions

View File

@@ -96,6 +96,13 @@
{:bank-account/type [*]}]}]}]
ids)
(map #(update % :journal-entry/date c/from-date))
(filter (fn [je]
(every?
(fn [jel]
(let [include-in-reports (-> jel :journal-entry-line/account :bank-account/include-in-reports)]
(or (nil? include-in-reports)
(true? include-in-reports))))
(:journal-entry/line-items je))))
(group-by :db/id))]
(->> ids
(map results)

View File

@@ -71,6 +71,21 @@
(seq vs) (conj {:db/id e
a vs})))})}]])
(defn add-include-in-reports [conn]
(let [existing-accounts (->> (d/query {:query {:find ['?e]
:in ['$]
:where ['[?e :bank-account/name]]}
:args [(d/db conn)]})
(transduce
(comp
(map first)
(map (fn [bank-account]
{:db/id bank-account :bank-account/include-in-reports true})))
conj
[]))]
[existing-accounts]))
(defn -main [& args]
(println "Creating database ..." uri)
(doto (d/create-database uri) println)
@@ -257,7 +272,13 @@
:db/doc "An identifier for this forcasted transaction, e.g., 'RENT'"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}]]}
:auto-ap/add-manager-schema {:txes [[{:db/ident :user-role/manager}]]}}
:auto-ap/add-manager-schema {:txes [[{:db/ident :user-role/manager}]]}
:auto-ap/add-include-in-reports1 {:txes [[{:db/ident :bank-account/include-in-reports
:db/doc "Whether to include this bank account in balance sheet, etc."
:db/valueType :db.type/boolean
:db/cardinality :db.cardinality/one}]]
:depends-on [:auto-ap/add-manager-schema]}
:auto-ap/migrate-include-in-reports {:txes-fn `add-include-in-reports :depends-on [:auto-ap/add-include-in-reports1] }}
]
(println "Conforming database...")
(c/ensure-conforms conn norms-map)