Use title inside of survey data instead of admin title for user display

Resolves MS-905 #complete
This commit is contained in:
Ramon Wenger 2024-03-28 17:08:09 +01:00
parent 1ad482c651
commit 446f6ad563
1 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,15 @@ class SurveyNode(DjangoObjectType):
def resolve_path(root: Survey, info, **kwargs):
return root.route
@staticmethod
def resolve_title(root: Survey, info, **kwargs):
try:
pages = root.data["pages"]
title = pages[0]["title"]
return title
except KeyError:
return root.title
class SurveysQuery(object):
survey = graphene.Field(SurveyNode, id=graphene.ID())