Fix a bug in StatsPanel : min and max amount must be multiplied by 100 before search operation

This commit is contained in:
Grégory Soutadé 2017-10-29 18:21:54 +01:00 committed by Grégory Soutadé
parent 5afa2480b4
commit 0b096d88bd
1 changed files with 5 additions and 3 deletions

View File

@ -202,7 +202,7 @@ std::vector<Operation> * SearchBanner::Search()
if (_amountFrom->text().length()) if (_amountFrom->text().length())
{ {
amountFrom = new int; amountFrom = new int;
*amountFrom = _amountFrom->text().toInt(&ok); *amountFrom = _amountFrom->text().toInt(&ok)*100;
if (!ok) if (!ok)
{ {
QMessageBox::critical(0, _("Error"), _("Invalid amount from")); QMessageBox::critical(0, _("Error"), _("Invalid amount from"));
@ -215,7 +215,7 @@ std::vector<Operation> * SearchBanner::Search()
if (_amountTo->text().length()) if (_amountTo->text().length())
{ {
amountTo = new int; amountTo = new int;
*amountTo = _amountTo->text().toInt(&ok); *amountTo = _amountTo->text().toInt(&ok)*100;
if (!ok) if (!ok)
{ {
QMessageBox::critical(0, _("Error"), _("Invalid amount to")); QMessageBox::critical(0, _("Error"), _("Invalid amount to"));
@ -254,7 +254,9 @@ std::vector<Operation> * SearchBanner::Search()
if (_account->item(i)->checkState() == Qt::Checked) if (_account->item(i)->checkState() == Qt::Checked)
accounts.push_back((i) ? user->_accounts[i-1].id : 0); accounts.push_back((i) ? user->_accounts[i-1].id : 0);
_operations = _kiss->Search(description, dateFrom, dateTo, amountFrom, amountTo, categories, types, accounts, tags); _operations = _kiss->Search(description, dateFrom, dateTo,
amountFrom, amountTo, categories,
types, accounts, tags);
end: end:
delete dateFrom; delete dateFrom;