Exemple #1
0
 class Input:
     id = graphene.ID()
     name = graphene.String()
     scope = ScopeType()
     content = graphene.String()
     order = graphene.Int()
     habits = graphene.List(graphene.String)
Exemple #2
0
 class Input:
     name = graphene.String()
     description = graphene.String()
     status = StatusType()
     inbox = graphene.Boolean()
     scope = ScopeType()
     date = graphene.types.datetime.Date()
     deadline = graphene.types.datetime.Date()
     estimate = graphene.String()
Exemple #3
0
 class Input:
     id = graphene.ID()
     name = graphene.String()
     scope = ScopeType()
     icon = graphene.String()
     is_active = graphene.Boolean()
     duration = graphene.String()
     content = graphene.String()
     order = graphene.Int()
Exemple #4
0
 class Input:
     id = graphene.ID()
     name = graphene.String()
     description = graphene.String()
     status = StatusType()
     inbox = graphene.Boolean()
     scope = ScopeType()
     date = graphene.types.datetime.Date()
     deadline = graphene.types.datetime.Date()
     estimate = graphene.String()
     tags = graphene.List(graphene.ID)
     deletions = graphene.List(graphene.String)
Exemple #5
0
class Metric(graphene.ObjectType):
    users = graphene.Int(scope=ScopeType())

    def resolve_users(self, info, scope=None):
        kwargs = {}
        if scope is not None:
            kwargs['date_joined__gte'] = get_scope_by_name(scope)().start
        return User.objects.filter(**kwargs).count()

    active_users = graphene.Int(scope=ScopeType())

    def resolve_active_users(self, info, scope=Scope.MONTH.value):
        start = get_scope_by_name(scope)().start
        return User.objects.filter(
            experience__created__gte=start).distinct().count()

    journal_entries = graphene.Int(scope=ScopeType())

    def resolve_journal_entries(self, info, scope=None):
        kwargs = {}
        if scope is not None:
            kwargs['created__gte'] = get_scope_by_name(scope)().start
        return JournalEntry.objects.filter(**kwargs).count()

    outcomes = graphene.Int(scope=ScopeType())

    def resolve_outcomes(self, info, scope=None):
        kwargs = {}
        if scope is not None:
            kwargs['created__gte'] = get_scope_by_name(scope)().start
        return Outcome.objects.filter(**kwargs).count()

    focuses = graphene.Int(scope=ScopeType())

    def resolve_focuses(self, info, scope=None):
        kwargs = {}
        if scope is not None:
            kwargs['created__gte'] = get_scope_by_name(scope)().start
        return Focus.objects.filter(**kwargs).count()

    gender_quote = graphene.String(scope=ScopeType())

    def resolve_gender_quote(self, info, scope=None):
        kwargs = {}
        if scope is not None:
            kwargs['date_joined__gte'] = get_scope_by_name(scope)().start
        males = User.objects.filter(**kwargs).filter(gender=User.MALE).count()
        females = User.objects.filter(**kwargs).filter(
            gender=User.FEMALE).count()
        neutrals = User.objects.filter(**kwargs).filter(
            gender=User.NEUTRAL).count()
        total = males + females + neutrals
        if not total:
            return '0% male, 0% female, 0% neutral'
        return '{males:.0f}% male, {females:.0f}% female, {neutrals:.0f}% neutral'.format(
            males=males / total * 100,
            females=females / total * 100,
            neutrals=neutrals / total * 100)
Exemple #6
0
 class Input:
     name = graphene.String()
     scope = ScopeType()
     content = graphene.String()
Exemple #7
0
 class Input:
     id = graphene.ID()
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     outcomes = graphene.List(graphene.ID)
     reason = graphene.String()
Exemple #8
0
 class Input:
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     keywords = graphene.String()
     content = graphene.String()
Exemple #9
0
 class Input:
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     likes = graphene.String()
     dislikes = graphene.String()