Skip to content

Commit

Permalink
[price-quotes] Extract function GncQuotesImpl::comm_vec_to_json_string.
Browse files Browse the repository at this point in the history
  • Loading branch information
jralls committed Oct 2, 2022
1 parent e3ab384 commit dd83167
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libgnucash/app-utils/gnc-quotes.cpp
Expand Up @@ -94,6 +94,7 @@ class GncQuotesImpl
private:
void query_fq (void);
void parse_quotes (void);
std::string comm_vec_to_json_string(void) const;

std::unique_ptr<GncQuoteSource> m_quotesource;
CommVec m_comm_vec;
Expand Down Expand Up @@ -298,8 +299,8 @@ format_quotes (const std::vector<gnc_commodity*>)
return std::vector <std::string>();
}

void
GncQuotesImpl::query_fq (void)
std::string
GncQuotesImpl::comm_vec_to_json_string (void) const
{
bpt::ptree pt, pt_child;
pt.put ("defaultcurrency", gnc_commodity_get_mnemonic (m_dflt_curr));
Expand All @@ -325,8 +326,14 @@ GncQuotesImpl::query_fq (void)

std::ostringstream result;
bpt::write_json(result, pt);
return result.str();
}

auto [rv, quotes, errors] = m_quotesource->get_quotes(result.str());
void
GncQuotesImpl::query_fq (void)
{
auto json_str{comm_vec_to_json_string()};
auto [rv, quotes, errors] = m_quotesource->get_quotes(json_str);
m_fq_answer.clear();
m_cmd_result = rv;
if (rv == 0)
Expand Down

0 comments on commit dd83167

Please sign in to comment.