commit cdb30902ae4252a61734d97c4fd1857d88aab46e
parent 3dc173d2f54daebfced83caa4eabaa2d253be300
Author: srfsh <dev@srf.sh>
Date: Thu, 17 Nov 2022 17:12:48 +0300
Zenflows.VF.EconomicEvent.Domain: unalias Decimal
Diffstat:
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/zenflows/vf/economic_event/domain.ex b/src/zenflows/vf/economic_event/domain.ex
@@ -30,7 +30,6 @@ alias Zenflows.VF.{
Measure,
Process,
}
-alias Decimal, as: D
@spec one(Ecto.Repo.t(), Schema.id() | map() | Keyword.t())
:: {:ok, EconomicEvent.t()} | {:error, String.t()}
@@ -258,8 +257,8 @@ defp handle_insert(key, %{action_id: action_id} = evt, _)
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- accounting_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
- onhand_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ accounting_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
+ onhand_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
end
defp handle_insert(key, %{action_id: action_id} = evt, _)
@@ -535,7 +534,7 @@ defp handle_insert(key, %{action_id: "accept"} = evt, _) do
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- onhand_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ onhand_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
end
defp handle_insert(key, %{action_id: "modify"} = evt, _) do
@@ -705,7 +704,7 @@ defp handle_insert(key, %{action_id: "transferCustody"} = evt, res_params) do
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- onhand_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ onhand_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
|> Multi.merge(fn %{^key => evt} ->
if res.container? do
@@ -829,7 +828,7 @@ defp handle_insert(key, %{action_id: "transferAllRights"} = evt, res_params) do
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- accounting_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ accounting_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
|> Multi.merge(fn %{^key => evt} ->
if res.container? do
@@ -962,8 +961,8 @@ defp handle_insert(key, %{action_id: "transfer"} = evt, res_params) do
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- accounting_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
- onhand_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ accounting_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
+ onhand_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
|> Multi.merge(fn %{^key => evt} ->
if res.container? do
@@ -1101,8 +1100,8 @@ defp handle_insert(key, %{action_id: "move"} = evt, res_params) do
where(EconomicResource, id: ^evt.resource_inventoried_as_id),
set: [previous_event_id: evt.id],
inc: [
- accounting_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
- onhand_quantity_has_numerical_value: D.negate(evt.resource_quantity_has_numerical_value),
+ accounting_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
+ onhand_quantity_has_numerical_value: Decimal.negate(evt.resource_quantity_has_numerical_value),
])
|> Multi.merge(fn %{^key => evt} ->
if res.container? do