Skip to content

Commit

Permalink
Merge pull request #1035 from betagouv/chore/task-recommendation-perf
Browse files Browse the repository at this point in the history
[chore] Réduction du nombre de requêtes en db sur la page des préfléchages
  • Loading branch information
glibersat authored Feb 11, 2025
2 parents 41ac932 + 33b211f commit c15f200
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion recoco/apps/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,12 @@ def trigged_by(self):

triggers = {}
for tag in self.condition_tags:
triggers[tag] = TaggedItem.objects.get_by_model(survey_models.Choice, tag)
triggers[tag] = TaggedItem.objects.get_by_model(
survey_models.Choice.objects.prefetch_related(
"question__question_set"
).select_related("question"),
tag,
)

return triggers

Expand Down

0 comments on commit c15f200

Please sign in to comment.