Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No repeat if no commands #421

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/engine/src/coincenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ Coincenter::Coincenter(const CoincenterInfo &coincenterInfo, const ExchangeSecre
_queryResultPrinter(coincenterInfo.apiOutputType()) {}

int Coincenter::process(const CoincenterCommands &coincenterCommands) {
const int nbRepeats = coincenterCommands.repeats();
int nbCommandsProcessed = 0;
auto commands = coincenterCommands.commands();
const int nbRepeats = commands.empty() ? 0 : coincenterCommands.repeats();
for (int repeatPos = 0; repeatPos != nbRepeats; ++repeatPos) {
if (repeatPos != 0) {
std::this_thread::sleep_for(coincenterCommands.repeatTime());
Expand All @@ -39,7 +40,7 @@ int Coincenter::process(const CoincenterCommands &coincenterCommands) {
log::info("Processing request {}/{}", repeatPos + 1, nbRepeats);
}
}
for (const CoincenterCommand &cmd : coincenterCommands.commands()) {
for (const CoincenterCommand &cmd : commands) {
processCommand(cmd);
++nbCommandsProcessed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/objects/src/coincenterinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ CurrencyCode CoincenterInfo::standardizeCurrencyCode(std::string_view currencyCo
while (begIt != endIt && isSeparator(*begIt)) {
++begIt;
}
std::transform(begIt, endIt, std::back_inserter(formattedCurrencyCode), [](char ch) { return toupper(ch); });
std::transform(begIt, endIt, std::back_inserter(formattedCurrencyCode), toupper);
log::debug("Transformed '{}' into '{}'", currencyCode, formattedCurrencyCode);
currencyCode = formattedCurrencyCode;
break;
Expand Down