Skip to content

Commit

Permalink
add project count in analysisframework schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Dec 29, 2023
1 parent 4468790 commit 28f483a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/analysis_framework/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from utils.graphene.fields import DjangoPaginatedListObjectField, generate_type_for_serializer
from deep.permissions import AnalysisFrameworkPermissions as AfP
from project.schema import AnalysisFrameworkVisibleProjectType
from project.models import ProjectMembership
from project.models import ProjectMembership, Project
from assisted_tagging.models import PredictionTagAnalysisFrameworkWidgetMapping
from .models import (
AnalysisFramework,
Expand Down Expand Up @@ -122,6 +122,7 @@ class Meta:
),
required=True,
)
used_in_project_count = graphene.Int(required=True)

@staticmethod
def get_custom_node(_, info, id):
Expand All @@ -147,6 +148,10 @@ def resolve_allowed_permissions(root, info):
def resolve_tags(root, info):
return info.context.dl.analysis_framework.af_tags.load(root.id)

@staticmethod
def resolve_used_in_project_count(root, info):
return Project.objects.filter(analysis_framework=root.id, is_test=False).count()


class AnalysisFrameworkRoleType(DjangoObjectType):
class Meta:
Expand Down
2 changes: 2 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type AnalysisFrameworkDetailType {
clonedFrom: ID
allowedPermissions: [AnalysisFrameworkPermission!]!
tags: [AnalysisFrameworkTagType!]!
usedInProjectCount: Int
primaryTagging: [SectionType!]
secondaryTagging: [WidgetType!]
members: [AnalysisFrameworkMembershipType!]
Expand Down Expand Up @@ -218,6 +219,7 @@ type AnalysisFrameworkType {
clonedFrom: ID
allowedPermissions: [AnalysisFrameworkPermission!]!
tags: [AnalysisFrameworkTagType!]!
usedInProjectCount: Int
}

type AnalysisFrameworkVisibleProjectType {
Expand Down

0 comments on commit 28f483a

Please sign in to comment.