mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
fix: exclude hardcoded qs from dynamic table
This commit is contained in:
@@ -109,12 +109,12 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView):
|
|||||||
def build_question_answers(self, answer_set: models.OrganisationAnswerSet) -> typing.Dict[str, str]:
|
def build_question_answers(self, answer_set: models.OrganisationAnswerSet) -> typing.Dict[str, str]:
|
||||||
"""Collect answers to dynamic questions and join with commas."""
|
"""Collect answers to dynamic questions and join with commas."""
|
||||||
show_all = self.request.user.is_superuser
|
show_all = self.request.user.is_superuser
|
||||||
questions = models.OrganisationQuestion.objects.all()
|
questions = models.OrganisationQuestion.objects.filter(is_hardcoded=False)
|
||||||
if not show_all:
|
if not show_all:
|
||||||
questions = questions.filter(answer_is_public=True)
|
questions = questions.filter(answer_is_public=True)
|
||||||
|
|
||||||
question_answers = {}
|
question_answers = {}
|
||||||
for question in models.OrganisationQuestion.objects.all():
|
for question in questions:
|
||||||
answers = answer_set.question_answers.filter(question=question)
|
answers = answer_set.question_answers.filter(question=question)
|
||||||
question_answers[str(question)] = ', '.join(map(str, answers))
|
question_answers[str(question)] = ', '.join(map(str, answers))
|
||||||
|
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ class ProfileView(LoginRequiredMixin, DetailView):
|
|||||||
def build_question_answers(self, answer_set: models.PersonAnswerSet) -> typing.Dict[str, str]:
|
def build_question_answers(self, answer_set: models.PersonAnswerSet) -> typing.Dict[str, str]:
|
||||||
"""Collect answers to dynamic questions and join with commas."""
|
"""Collect answers to dynamic questions and join with commas."""
|
||||||
show_all = (self.object.user == self.request.user) or self.request.user.is_superuser
|
show_all = (self.object.user == self.request.user) or self.request.user.is_superuser
|
||||||
questions = models.PersonQuestion.objects.all()
|
questions = models.PersonQuestion.objects.filter(is_hardcoded=False)
|
||||||
if not show_all:
|
if not show_all:
|
||||||
questions = questions.filter(answer_is_public=True)
|
questions = questions.filter(answer_is_public=True)
|
||||||
|
|
||||||
question_answers = {}
|
question_answers = {}
|
||||||
for question in models.PersonQuestion.objects.all():
|
for question in questions:
|
||||||
answers = answer_set.question_answers.filter(question=question)
|
answers = answer_set.question_answers.filter(question=question)
|
||||||
question_answers[str(question)] = ', '.join(map(str, answers))
|
question_answers[str(question)] = ', '.join(map(str, answers))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user