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

Added clearer error messages for the nRequest amount validation #609

Merged
merged 3 commits into from
Nov 1, 2019

Conversation

mxaddict
Copy link
Contributor

No description provided.

if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) {
str = "Requested amount %1 is more than avaible coins in the proposal (%2)\n";
}
msgBox.setText(tr(str.c_str()).arg(NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount), NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tr() should receive a string as an argument so the parser can correctly extract the text iirc.

             std::string str = tr("Requested amount must be greater than 0 NAV (Zero)");
             if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) {
                 str = tr("Requested amount %1 is more than avaible coins in the proposal (%2)");
             }
             msgBox.setText(str.arg(NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount), NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true))));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aguycalled you mean the tr() call needs to have the string passed inline? and not via variable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep iirc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this:

            QString str = tr("Requested amount must be greater than 0 NAV (Zero)\n");
            if (nReqAmount > proposal.GetAvailable(*pcoinsTip, true)) {
                str = tr("Requested amount %1 is more than avaible coins in the proposal (%2)\n")
                    .arg(
                        NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, nReqAmount),
                        NavCoinUnits::formatWithUnit(NavCoinUnits::NAV, proposal.GetAvailable(*pcoinsTip, true))
                    );
            }
            msgBox.setText(str);

@mxaddict mxaddict force-pushed the clearer-payment-request-errors branch from 41c5257 to 9d35495 Compare October 16, 2019 18:38
…st-errors

 Conflicts:
	src/qt/communityfundcreatepaymentrequestdialog.cpp
@mxaddict
Copy link
Contributor Author

Fixed merge conflict

Copy link
Contributor

@chasingkirkjufell chasingkirkjufell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally and worked as expected on 18.10
image

@mxaddict
Copy link
Contributor Author

Lets merge this after 4.7.1 release

@aguycalled aguycalled merged commit 1e73c05 into navcoin:master Nov 1, 2019
@dantudor
Copy link
Contributor

dantudor commented Nov 1, 2019

str = "Requested amount %1 is more than avaible coins in the proposal (%2)\n";
Should be:
str = "Requested amount %1 is more than availble coins in the proposal (%2)\n";

@chasingkirkjufell
Copy link
Contributor

good catch but isn't it actually "available" ?

aguycalled pushed a commit that referenced this pull request Nov 1, 2019
aguycalled pushed a commit to aguycalled/navcoin-core that referenced this pull request Dec 5, 2019
…oin#609)

* Added clearer error messages for the nRequest amount validation

* Added fix for tr calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants