Skip to content

Commit 06daa0f

Browse files
Merge pull request #364 from RSE-Sheffield/fix/survey-field-bug
Revert a change that broke things
2 parents b8eacf2 + cb32580 commit 06daa0f

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

home/models.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,4 @@ def is_active(self) -> bool:
131131
"""
132132
Does this project contain any active surveys?
133133
"""
134-
return any(self.surveys.values_list("is_active", flat=True))
135-
136-
@property
137-
def survey_count(self) -> int:
138-
"""
139-
How many surveys are organised within this project?
140-
"""
141-
return self.surveys.count()
134+
return any(self.survey.values_list("is_active", flat=True))

home/templates/organisation/organisation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2 class="text-2xl font-bold d-inline-block">Projects</h2>
4848
<div class="card-body">
4949
<p class="h5 card-title" title="Project identifier {{ project.pk }}">{{ project.name }}</p>
5050
<p class="h6 card-subtitle text-muted mb-2">{{ project.description|default_if_none:"No description provided." }}</p>
51-
<p class="h7 card-text">Surveys: {{ project.survey_count }}</p>
51+
<p class="h7 card-text">Surveys: {{ project.survey.count }}</p>
5252

5353
<div class="mt-2 w-100 d-flex flex-wrap justify-content-end gap-2">
5454
{% if can_edit|get_item:project.id %}

survey/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Survey(models.Model):
3333
survey_config = models.JSONField(null=True)
3434
consent_config = models.JSONField(null=True)
3535
demography_config = models.JSONField(null=True)
36-
project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True, related_name="surveys")
36+
project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True, related_name="survey")
3737
created_at = models.DateTimeField(auto_now_add=True)
3838
survey_body_path = models.TextField(blank=True, null=True)
3939
is_active = models.BooleanField(

0 commit comments

Comments
 (0)