From 1ff3f3a1a5e4b9ea80feea611d7a10ab690c5c6f Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Sat, 8 Sep 2001 07:44:46 +0000 Subject: [PATCH] Fix bug quoting more than one currency. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5342 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/scm/price-quotes.scm | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/scm/price-quotes.scm b/src/scm/price-quotes.scm index 0c92143310..5e873964b7 100644 --- a/src/scm/price-quotes.scm +++ b/src/scm/price-quotes.scm @@ -31,6 +31,8 @@ ;; (use-modules (www main)) +(use-modules (srfi srfi-1)) + ;; (use-modules (srfi srfi-19)) when available (see below). (define (yahoo-get-historical-quotes symbol @@ -376,20 +378,31 @@ currency fq-method-sym 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))) - (cmd-hash (make-hash-table 31))) + (let* ((big-list (delete #f (map account->fq-cmd account-list))) + (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. (item-list->hash! cmd-list cmd-hash car cdr hashq-ref hashq-set! #t) + ;; Now translate to just what finance-quote-helper expects. - (hash-fold - (lambda (key value prior-result) - (cons (cons (fq-method-sym->str key) value) - prior-result)) - '() - cmd-hash))) + (append + (hash-fold + (lambda (key value prior-result) + (cons (cons (fq-method-sym->str key) value) + prior-result)) + '() + 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) ;; take an output element from accounts->fq-call-data and return a