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

Changing error message when setting pricing rules #2069

Merged
merged 3 commits into from
Jul 22, 2020
Merged

Conversation

hemahg
Copy link
Contributor

@hemahg hemahg commented Jul 21, 2020

What this PR does / why we need it:

changing the error message when setting pricing rules

Which issue(s) this PR fixes

https://issues.redhat.com/browse/THREESCALE-5565

Verification steps
Screenshot from 2020-07-21 14-40-48

@hemahg hemahg requested review from macejmic and Martouta July 21, 2020 09:30
@hemahg hemahg requested a review from thomasmaas July 21, 2020 16:16
Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

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

Please add test(s) ensuring that it responds with the right error messages when it is appropriate

end

if max && max < min
errors.add(:max, "'To' value cannot be less than your 'From' value.")
errors.add(:max, :to_value_cannot_be_less_that_from_value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
errors.add(:max, :to_value_cannot_be_less_that_from_value)
errors.add(:max, :min_max_mismatch)

min:
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules"
max:
to_value_cannot_be_less_that_from_value: "'To' value cannot be less than your 'From' value."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
to_value_cannot_be_less_that_from_value: "'To' value cannot be less than your 'From' value."
min_max_mismatch: "'To' value cannot be less than your 'From' value."

@@ -88,11 +88,11 @@ def range_overlap
end

if overlap #rules.count > 0
errors.add(:min, "'From' value cannot be less than 'To' values of current rules.")
errors.add(:min, :overlap_message)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
errors.add(:min, :overlap_message)
errors.add(:min, :overlap)

pricing_rule:
attributes:
min:
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
overlap_message: "The 'From' value must be greater than the 'To' values of other existing rules"
overlap: "The 'From' value must be greater than the 'To' values of other existing rules"

@hemahg hemahg requested a review from Martouta July 22, 2020 12:58
Copy link
Contributor

@Martouta Martouta left a comment

Choose a reason for hiding this comment

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

👏 💪 🥇 🎉

@hemahg hemahg merged commit 9aeb292 into master Jul 22, 2020
@hemahg hemahg deleted the 5565_pricing_rules branch July 22, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants