Browse files

Fixed a problem with xact-cost

  • Loading branch information...
1 parent 96d4900 commit acc13f6b0e453e93754638c9131dad13044d15f4 @jwiegley committed Dec 14, 2007
Showing with 12 additions and 6 deletions.
  1. +1 −2 core/transaction.lisp
  2. +11 −4 core/valexpr.lisp
View
3 core/transaction.lisp
@@ -46,8 +46,7 @@
(declaim (inline xact-cost set-xact-cost))
(defun xact-cost (xact)
- (or (get-xact-cost xact)
- (xact-amount xact)))
+ (get-xact-cost xact))
(defun set-xact-cost (xact value)
(setf (get-xact-cost xact) value))
(defsetf xact-cost set-xact-cost)
View
15 core/valexpr.lisp
@@ -137,10 +137,13 @@
((member symbol '(|i| |price|) :test #'eq)
(apply-this-or-last
(lambda (xact)
- (divide (xact-cost xact) (xact-amount xact)))))
+ (divide (or (xact-cost xact)
+ (xact-amount xact)) (xact-amount xact)))))
((member symbol '(|b| |cost|) :test #'eq)
- (apply-this-or-last #'xact-cost))
+ (apply-this-or-last
+ (lambda (xact)
+ (or (xact-cost xact) (xact-amount xact)))))
((member symbol '(|d| |date|) :test #'eq)
(apply-this-or-last #'xact-date))
@@ -179,10 +182,14 @@
;; of a "cost balance"; but this can be maintained
(apply-this-or-last
(lambda (xact)
- (divide (xact-cost-total xact) (xact-total xact)))))
+ (divide (or (xact-cost-total xact)
+ (xact-total xact)) (xact-total xact)))))
((member symbol '(|B| |total_cost|) :test #'eq)
- (apply-this-or-last #'xact-cost-total))
+ (apply-this-or-last
+ (lambda (xact)
+ (or (xact-cost-total xact)
+ (xact-total xact)))))
((eq symbol '|line|)
(lambda (xact &rest args)

0 comments on commit acc13f6

Please sign in to comment.