Commit d0b8a67d authored by Lynn Foster's avatar Lynn Foster
Browse files

fixed bugs in resource qty updates

parent 45b245b8
......@@ -76,7 +76,6 @@ class CreateTransfer(AuthedMutation):
receiver_affects = None
if receiver_affects_id:
receiver_affects = EconomicResourceProxy.objects.get(pk=receiver_affects_id)
receiver_affects.quantity = receiver_affects.quantity + Decimal(affected_numeric_value)
if not receiver_affects:
if create_resource:
if not resource_note:
......@@ -141,7 +140,7 @@ class CreateTransfer(AuthedMutation):
if is_authorized:
transfer.save_api()
give_event.transfer = transfer
give_event.save_api(user=context.user, create_resource=create_resource)
give_event.save_api(user=context.user, create_resource=False)
if receiver_affects:
receiver_affects.save()
receive_event.resource = receiver_affects
......@@ -161,4 +160,3 @@ class CreateTransfer(AuthedMutation):
raise PermissionDenied('User not authorized to perform this action.')
return CreateTransfer(transfer=transfer)
......@@ -3751,7 +3751,7 @@ mutation ($token: String!) {
createTransfer(token: $token,
providerId: 39,
receiverId: 26,
affectsId: 111,
affectsId: 124,
affectedNumericValue: "1",
start: "2020-02-10",
createResource: true,
......@@ -3816,6 +3816,72 @@ mutation ($token: String!) {
}
}
mutation ($token: String!) {
createTransfer(token: $token,
providerId: 39,
receiverId: 26,
affectsId: 124,
receiverAffectsId: 129,
affectedNumericValue: "3",
start: "2020-02-10",
createResource: false) {
transfer {
id
name
plannedDate
scope {
name
}
note
provider {
name
}
receiver {
name
}
giveResource {
id
trackingIdentifier
}
takeResource {
id
trackingIdentifier
}
transferQuantity {
numericValue
unit {
name
}
}
transferEconomicEvents {
action
}
giveEconomicEvent {
id
action
provider {
name
}
receiver {
name
}
affectedQuantity {
numericValue
unit {
name
}
}
}
takeEconomicEvent {
id
action
}
involvedAgents {
id
name
}
}
}
}
'''
......@@ -12137,7 +12137,7 @@ class EconomicEvent(models.Model):
# old_resource = None
# else:
# has_new_resource = True
resource = self.resource
if resource:
#quantity = delta or self.quantity
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment