<commit_before>#
# EconomicResource:
#

import graphene
from graphene_django.types import DjangoObjectType

import valuenetwork.api.types as types
from valuenetwork.valueaccounting.models import EconomicResource as EconomicResourceProxy
from valuenetwork.api.models import QuantityValue as QuantityValueProxy

class EconomicResourceCategory(graphene.Enum):
    NONE = None
    CURRENCY = "currency"
    INVENTORY = "inventory"

class EconomicResource(DjangoObjectType):  #graphene.Interface):
    resource_type = graphene.String(source='resource_type_name') # need to figure this out with VF gang
    tracking_identifier = graphene.String(source='tracking_identifier')
    image = graphene.String(source='image')
    #numeric_value = graphene.Float(source='numeric_value') #need to implement as quantity-value with unit
    #unit = graphene.String(source='unit')
    current_quantity = graphene.Field(lambda: types.Agent) 
    note = graphene.String(source='note')
    category = graphene.String(source='category')

    class Meta:
        model = EconomicResourceProxy
        only_fields = ('id')

    def resolve_current_quantity(self, args, *rargs):
        return None #QuantityValueProxy(numeric_value=self.quantity, unit=self.unit)<commit_msg>change QuantityValue field in EconomicResourceCategory so it is a type, not a module or class<commit_after>#
# EconomicResource:
#

import graphene
from graphene_django.types import DjangoObjectType

import valuenetwork.api.types as types
from valuenetwork.valueaccounting.models import EconomicResource as EconomicResourceProxy
#from valuenetwork.api.models import QuantityValue as QuantityValueProxy
from valuenetwork.api.types.QuantityValue import QuantityValue

class EconomicResourceCategory(graphene.Enum):
    NONE = None
    CURRENCY = "currency"
    INVENTORY = "inventory"

class EconomicResource(DjangoObjectType):  #graphene.Interface):
    resource_type = graphene.String(source='resource_type_name') # need to figure this out with VF gang
    tracking_identifier = graphene.String(source='tracking_identifier')
    image = graphene.String(source='image')
    #numeric_value = graphene.Float(source='numeric_value') #need to implement as quantity-value with unit
    #unit = graphene.String(source='unit')
    current_quantity = graphene.Field(lambda: QuantityValue)
    note = graphene.String(source='note')
    category = graphene.String(source='category')

    class Meta:
        model = EconomicResourceProxy
        only_fields = ('id')

    def resolve_current_quantity(self, args, *rargs):
        return QuantityValueProxy(numeric_value=self.quantity, unit=self.unit)
{'fraction_non_alphanumeric': 0.0867752936718454, 'fraction_numerical': 0.0, 'mean_word_length': 5.270783847980997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2878682', 'n_tokens_mistral': 776, 'n_tokens_neox': 707, 'n_words': 178}