Skip to content

Commit

Permalink
Fixed balance calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
stathissideris committed Sep 14, 2011
1 parent f2f66ec commit e9efaac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/moneyz/barclays.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
(defn split-by-account [statement]
(into {}
(map
(fn [[key d]] [key (dataset (:column-names statement) d)])
(fn [[key d]] [key (dataset (:column-names statement) (sort-by :Date d))])
(group-by :Account (:rows statement)))))

(defn calculate-balance-column [statement]
(reverse (reductions + (reverse (map :Amount (:rows statement))))))
(reductions + (map :Amount (:rows statement))))

(defn add-balance-column [statement]
(let [balance-column (calculate-balance-column statement)]
Expand Down

0 comments on commit e9efaac

Please sign in to comment.