Fix bug quoting more than one currency.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5342 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-08 07:44:46 +00:00
parent 9d48cfe7df
commit 1ff3f3a1a5

View File

@ -31,6 +31,8 @@
;; ;;
(use-modules (www main)) (use-modules (www main))
(use-modules (srfi srfi-1))
;; (use-modules (srfi srfi-19)) when available (see below). ;; (use-modules (srfi srfi-19)) when available (see below).
(define (yahoo-get-historical-quotes symbol (define (yahoo-get-historical-quotes symbol
@ -376,20 +378,31 @@
currency currency
fq-method-sym fq-method-sym
mnemonic mnemonic
(cons fq-method-sym (list commodity currency tz))))) (list fq-method-sym commodity currency tz))))
(let ((cmd-list (delete #f (map account->fq-cmd account-list))) (let* ((big-list (delete #f (map account->fq-cmd account-list)))
(cmd-hash (make-hash-table 31))) (cmd-list #f)
(currency-cmd-list (call-with-values
(lambda () (partition!
(lambda (cmd)
(not (eq? (car cmd) 'currency)))
big-list))
(lambda (a b) (set! cmd-list a) b)))
(cmd-hash (make-hash-table 31)))
;; Now collect symbols going to the same backend. ;; Now collect symbols going to the same backend.
(item-list->hash! cmd-list cmd-hash car cdr hashq-ref hashq-set! #t) (item-list->hash! cmd-list cmd-hash car cdr hashq-ref hashq-set! #t)
;; Now translate to just what finance-quote-helper expects. ;; Now translate to just what finance-quote-helper expects.
(hash-fold (append
(lambda (key value prior-result) (hash-fold
(cons (cons (fq-method-sym->str key) value) (lambda (key value prior-result)
prior-result)) (cons (cons (fq-method-sym->str key) value)
'() prior-result))
cmd-hash))) '()
cmd-hash)
(map (lambda (cmd) (cons (fq-method-sym->str (car cmd)) (list (cdr cmd))))
currency-cmd-list))))
(define (fq-call-data->fq-calls fq-call-data) (define (fq-call-data->fq-calls fq-call-data)
;; take an output element from accounts->fq-call-data and return a ;; take an output element from accounts->fq-call-data and return a