def getQuestionnaire(ownerId, questionnaireId, isAdmin):
     from app.models.problem import Problem
     q = Questionnaire.objects.filter(
         ownerId=ownerId, questionnaireId=questionnaireId).first()
     if not q:
         raise NoQuestionnaire
     return {
         "basicInfo": q.getConditionJson(isAdmin=isAdmin),
         "problems": Problem.getProblems(questionnaireId)
     }
 def checkSecretKey(questionnaireId, key):
     from app.models.problem import Problem
     q = Questionnaire.objects.filter(
         questionnaireId=questionnaireId).first()
     if not q:
         raise NoQuestionnaire
     if q.secretKey != key and q.isSecret:
         raise WrongProblemSecretKey
     return {
         "basicInfo": q.getConditionJson(isAdmin=False),
         "problems": Problem.getProblems(questionnaireId)
     }