Example #1
0
 def neck(self):
     try:
         return diacore.get_traits(user_pk=self.user_pk,
                                   kind=TraitKind.NECK_PERIMETER_CM,
                                   order_ascending=False,
                                   limit=1)[0]
     except IndexError:
         return None
Example #2
0
 def weight(self):
     try:
         return diacore.get_traits(user_pk=self.user_pk,
                                   kind=TraitKind.WEIGHT_KG,
                                   order_ascending=False,
                                   limit=1)[0]
     except IndexError:
         return None
Example #3
0
 def sex(self):
     try:
         return diacore.get_traits(user_pk=self.user_pk,
                                   kind=TraitKind.SEX,
                                   order_ascending=False,
                                   limit=1)[0]
     except IndexError:
         return None
Example #4
0
    def age(self):
        try:
            birth_utc_timestamp = diacore.get_traits(
                user_pk=self.user_pk,
                kind=TraitKind.BIRTH_UTC_TIMESTAMP,
                order_ascending=False,
                limit=1)[0]
        except IndexError:
            return None

        timedelta = self.current_datetime - Datetime.utcfromtimestamp(
            birth_utc_timestamp)
        return timedelta.total_years
Example #5
0
from dia.core import diacore
from dia.models import Trait, TraitKind

print diacore.get_traits(1, kind=TraitKind.HEIGHT_CM, limit=1)[0]