Commit cce80e8c authored by phil's avatar phil

add addendum feature and fix start script

parent 8167b691
......@@ -4,7 +4,7 @@
# saves quite some time, because we don't need to fire up a jvm just
# to establish a classpath
BASEDIR=$(dirname "$0")/..
BASEDIR=$(cd "$(dirname "$0")/.."; pwd)
KLASSPATHFILE=./.classpath
if [ ! -f $KLASSPATHFILE ]; then
......@@ -13,6 +13,7 @@ if [ ! -f $KLASSPATHFILE ]; then
fi
KLASSPATH=$(cat $KLASSPATHFILE)
export NODE_PATH=$BASEDIR/node_modules
exec $BASEDIR/node_modules/.bin/lumo -K -c "$KLASSPATH" -m easy.core $@
......@@ -10,6 +10,7 @@
```"
(:require [cljs.spec.alpha :as s]
[cljs-time.format :as time]
[clojure.string :as str]
[easy.util :as util :refer [assoc*]]
[easy.common :as common]
[easy.common.tax :as tax]
......@@ -27,6 +28,9 @@
(s/def ::amount float?)
(s/def ::description string?)
(s/def ::addendum (s/or :string string?
:number number?))
(s/def ::description-with-addendum string?)
(s/def ::ledger-template (s/and string? common/match-template))
(s/def ::event (s/keys :req-un [::type
......@@ -35,6 +39,8 @@
::payer
::account]
:opt-un [::description
::addendum
::description-with-addendum
::ledger-template]))
......@@ -65,6 +71,14 @@
(assoc* evt :respect-tax-amount)))
(defn- add-description-with-addendum [evt]
(->> [:description :addendum]
(map evt)
(remove nil?)
(str/join " ")
(assoc* evt :description-with-addendum)))
(defmethod transform :expense [_ evt]
(-> evt
(common/validate! ::event)
......@@ -72,6 +86,7 @@
add-respect-tax-rate
add-respect-tax-amount
tax/add-period
add-description-with-addendum
(assoc* :ledger-template
(get-in @config [:templates :ledger :expense]))
(common/validate! ::event)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment