Safely access the code property

This commit is contained in:
Ramon Wenger 2024-07-11 14:24:59 +02:00 committed by Christian Cueni
parent 31df04357b
commit 281b7c900c
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ class CourseSessionUserExpertCircleType(ObjectType):
class CourseSessionUserType(DjangoObjectType): class CourseSessionUserType(DjangoObjectType):
chosen_profile = graphene.String() chosen_profile = graphene.String(required=True)
course_session = graphene.Field( course_session = graphene.Field(
"vbv_lernwelt.course.graphql.types.CourseSessionObjectType", required=True "vbv_lernwelt.course.graphql.types.CourseSessionObjectType", required=True
) )
@ -158,7 +158,7 @@ class CourseSessionUserType(DjangoObjectType):
@staticmethod @staticmethod
def resolve_chosen_profile(root: CourseSessionUser, info, **kwargs): def resolve_chosen_profile(root: CourseSessionUser, info, **kwargs):
return root.chosen_profile.code return getattr(root.chosen_profile, "code", "")
class CourseSessionUserObjectsType(ObjectType): class CourseSessionUserObjectsType(ObjectType):