예제 #1
0
파일: schema.py 프로젝트: swoopyy/colegend
 class Input:
     id = graphene.ID()
     name = graphene.String()
     scope = ScopeType()
     content = graphene.String()
     order = graphene.Int()
     habits = graphene.List(graphene.String)
예제 #2
0
파일: schema.py 프로젝트: swoopyy/colegend
 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()
예제 #3
0
파일: schema.py 프로젝트: swoopyy/colegend
 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()
예제 #4
0
파일: schema.py 프로젝트: swoopyy/colegend
 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)
예제 #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)
예제 #6
0
파일: schema.py 프로젝트: swoopyy/colegend
 class Input:
     name = graphene.String()
     scope = ScopeType()
     content = graphene.String()
예제 #7
0
파일: schema.py 프로젝트: swoopyy/colegend
 class Input:
     id = graphene.ID()
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     outcomes = graphene.List(graphene.ID)
     reason = graphene.String()
예제 #8
0
 class Input:
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     keywords = graphene.String()
     content = graphene.String()
예제 #9
0
 class Input:
     scope = ScopeType()
     start = graphene.types.datetime.Date()
     likes = graphene.String()
     dislikes = graphene.String()