Last active
June 16, 2020 02:19
-
-
Save noelworden/e6d430271e4c2324e0699d32c2781334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@zero_with_decimal round(cast(0), 2) | |
rev_minus_cost = round(sub(total_merch_rev, total_group_costs), 2) | |
net_rev = round(net_revenue_shared, 2) | |
net_rev_valid = | |
Enum.any?([ | |
rev_minus_cost == @zero_with_decimal && net_rev == @zero_with_decimal, | |
rev_minus_cost == net_rev | |
]) | |
if net_rev_valid do | |
changeset | |
else | |
add_error( | |
changeset, | |
:net_revenue_shared, | |
"must be total_merch_rev minus total_group costs" | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment