Skip to content

Commit

Permalink
projects/tasks: use unfiltered queryset for project serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
goapunk committed Jul 22, 2024
1 parent cfc0d78 commit 7f60973
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions meinberlin/apps/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def set_cache_for_projects() -> str:
data = PastProjectSerializer(past_projects, now=now, many=True).data
cache.set("projects_" + "pastParticipation", data)

projects = active_projects.union(future_projects, past_projects)
data = ProjectSerializer(projects, now=now, many=True).data
data = ProjectSerializer(queryset, now=now, many=True).data
cache.set("projects_", data)

return logger.info("Reset cache for public projects.")
Expand Down
5 changes: 2 additions & 3 deletions tests/projects/test_tasks_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ def test_task_reset_cache_for_projects(
future_project = cache.get("projects_futureParticipation")
past_project = cache.get("projects_pastParticipation")
projects = cache.get("projects_")
assert active_projects is not None
print(active_projects)
assert len(active_projects) == 2
assert len(past_project) == 1
assert len(future_project) == 1
assert len(projects) == 4
# 2 active, 1 past, 1 future, 2 unspecified
assert len(projects) == 6

0 comments on commit 7f60973

Please sign in to comment.