Browse Source

Fix compile bug and use 0 instead of -1 for unknown price/volume

deadstrip
Duke Leto 5 years ago
parent
commit
21eb129eb1
  1. 10
      src/settings.cpp

10
src/settings.cpp

@ -172,20 +172,20 @@ double Settings::get_price(std::string currency) {
return search->second; return search->second;
} else { } else {
qDebug() << "Could not find price of" << ticker << "!!!"; qDebug() << "Could not find price of" << ticker << "!!!";
return -1.0; return 0.0;
} }
} }
void Settings::set_price(std::string curr, double price) { void Settings::set_price(std::string curr, double price) {
QString ticker = QString::fromStdString(curr); QString ticker = QString::fromStdString(curr);
qDebug() << "Setting price of " << ticker << "=" << QString::number(price); qDebug() << "Setting price of " << ticker << "=" << QString::number(price);
auto it = prices.insert( std::make_pair(curr, price) ); prices.insert( std::make_pair(curr, price) );
} }
void Settings::set_volume(std::string curr, double volume) { void Settings::set_volume(std::string curr, double volume) {
QString ticker = QString::fromStdString(curr); QString ticker = QString::fromStdString(curr);
qDebug() << "Setting volume of " << ticker << "=" << QString::number(volume); qDebug() << "Setting volume of " << ticker << "=" << QString::number(volume);
auto it = volumes.insert( std::make_pair(curr, volume) ); volumes.insert( std::make_pair(curr, volume) );
} }
double Settings::get_volume(std::string currency) { double Settings::get_volume(std::string currency) {
@ -197,14 +197,14 @@ double Settings::get_volume(std::string currency) {
return search->second; return search->second;
} else { } else {
qDebug() << "Could not find volume of" << ticker << "!!!"; qDebug() << "Could not find volume of" << ticker << "!!!";
return -1.0; return 0.0;
} }
} }
void Settings::set_marketcap(std::string curr, double marketcap) { void Settings::set_marketcap(std::string curr, double marketcap) {
QString ticker = QString::fromStdString(curr); QString ticker = QString::fromStdString(curr);
qDebug() << "Setting marketcap of " << ticker << "=" << QString::number(marketcap); qDebug() << "Setting marketcap of " << ticker << "=" << QString::number(marketcap);
auto it = marketcaps.insert( std::make_pair(curr, marketcap) ); marketcaps.insert( std::make_pair(curr, marketcap) );
} }
double Settings::get_marketcap(std::string currency) { double Settings::get_marketcap(std::string currency) {

Loading…
Cancel
Save