Last active
June 16, 2020 02:10
-
-
Save noelworden/72f255e315c45b1f847343a4cbb11d42 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
case Decimal.round(Decimal.sub(total_merch_rev, total_group_costs), 2) == | |
Decimal.round(Decimal.cast(0), 2) do | |
true -> | |
case net_revenue_shared == Decimal.cast(0) do | |
true -> | |
changeset | |
false -> | |
add_error( | |
changeset, | |
:net_revenue_shared, | |
"must be total_merch_rev minus total_group costs" | |
) | |
end | |
false -> | |
case Decimal.round(Decimal.sub(total_merch_rev, total_group_costs), 2) == | |
Decimal.round(net_revenue_shared, 2) do | |
true -> | |
changeset | |
false -> | |
add_error( | |
changeset, | |
:net_revenue_shared, | |
"must be total_merch_rev minus total_group costs" | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment