示例#1
0
 def resolve_fulfilled_by(self, args, context, info):
     events = self.fulfillment_events.all()
     fulfillments = []
     for event in events:
         fulfill = FulfillmentProxy(
             fulfilled_by=event,
             fulfills=self,
             fulfilled_quantity=QuantityValueProxy(
                 numeric_value=event.quantity, unit=event.unit_of_quantity),
         )
         fulfillments.append(fulfill)
     return fulfillments
示例#2
0
 def resolve_fulfills(self, args, context, info):
     commitment = self.commitment
     if commitment:
         fulfillment = Fulfillment(
             fulfilled_by=self,
             fulfills=commitment,
             fulfilled_quantity=QuantityValueProxy(
                 numeric_value=self.quantity, unit=self.unit_of_quantity),
         )
         ff_list = []
         ff_list.append(fulfillment)
         return ff_list
     return []
示例#3
0
 def resolve_fulfilled_by(self, args, context, info):
     events = self.fulfillment_events.all()
     request_distribution = args.get('request_distribution')
     if request_distribution != None:
         events = events.filter(is_contribution=request_distribution)
     fulfillments = []
     for event in events:
         fulfill = FulfillmentProxy(
             fulfilled_by=event,
             fulfills=self,
             fulfilled_quantity=QuantityValueProxy(numeric_value=event.quantity, unit=event.unit_of_quantity),
             )
         fulfillments.append(fulfill)
     return fulfillments
示例#4
0
 def resolve_affected_quantity(self, args, *rargs):
     return QuantityValueProxy(numeric_value=self.quantity,
                               unit=self.unit_of_quantity)
示例#5
0
 def resolve_transfer_quantity(self, args, *rargs):
     return QuantityValueProxy(numeric_value=self.actual_quantity(),
                               unit=self.unit)
示例#6
0
 def resolve_current_quantity(self, args, *rargs):
     return QuantityValueProxy(numeric_value=self.quantity, unit=self.unit)
示例#7
0
 def resolve_committed_quantity(self, context, **args):  #args, *rargs):
     return QuantityValueProxy(numeric_value=self.quantity,
                               unit=self.unit_of_quantity)