We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Container tile does not show number of projects 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `meinberlin/apps/plans/serializers.py`
Content:
```
1 from django.utils.translation import ugettext as _
2 from easy_thumbnails.files import get_thumbnailer
3 from rest_framework import serializers
4 
5 from adhocracy4.projects.models import Project
6 from meinberlin.apps.projects import get_project_type
7 
8 from .models import Plan
9 
10 
11 class CommonFields:
12 
13     def get_district(self, instance):
14         city_wide = _('City wide')
15         district_name = str(city_wide)
16         if instance.administrative_district:
17             district_name = instance.administrative_district.name
18         return district_name
19 
20     def get_point(self, instance):
21         point = instance.point
22         if not point:
23             point = ''
24         return point
25 
26 
27 class ProjectSerializer(serializers.ModelSerializer, CommonFields):
28     type = serializers.SerializerMethodField()
29     subtype = serializers.SerializerMethodField()
30     title = serializers.SerializerMethodField()
31     url = serializers.SerializerMethodField()
32     organisation = serializers.SerializerMethodField()
33     point = serializers.SerializerMethodField()
34     point_label = serializers.SerializerMethodField()
35     cost = serializers.SerializerMethodField()
36     district = serializers.SerializerMethodField()
37     status = serializers.SerializerMethodField()
38     participation = serializers.SerializerMethodField()
39     participation_active = serializers.SerializerMethodField()
40     participation_string = serializers.SerializerMethodField()
41     participation_display = serializers.SerializerMethodField()
42     future_phase = serializers.SerializerMethodField()
43     active_phase = serializers.SerializerMethodField()
44     past_phase = serializers.SerializerMethodField()
45     tile_image = serializers.SerializerMethodField()
46     plan_url = serializers.SerializerMethodField()
47     plan_title = serializers.SerializerMethodField()
48 
49     class Meta:
50         model = Project
51         fields = ['type', 'subtype', 'title', 'url',
52                   'organisation', 'tile_image',
53                   'tile_image_copyright',
54                   'point', 'point_label', 'cost',
55                   'district', 'topic',
56                   'status',
57                   'participation_string',
58                   'participation_active',
59                   'participation', 'participation_display', 'description',
60                   'future_phase', 'active_phase',
61                   'past_phase', 'plan_url', 'plan_title']
62 
63     def _get_participation_status_project(self, instance):
64         if instance.phases.active_phases():
65             return _('running'), True
66         elif instance.phases.future_phases():
67             try:
68                 return (_('starts at {}').format
69                         (instance.phases.future_phases().first().
70                          start_date.date()),
71                         True)
72             except AttributeError:
73                 return (_('starts in the future'),
74                         True)
75         else:
76             return _('done'), False
77 
78     def get_type(self, instance):
79         return 'project'
80 
81     def get_subtype(self, instance):
82         subtype = get_project_type(instance)
83         if subtype in ('external', 'bplan'):
84             return 'external'
85         return subtype
86 
87     def get_title(self, instance):
88         return instance.name
89 
90     def get_url(self, instance):
91         if get_project_type(instance) in ('external', 'bplan'):
92             return instance.externalproject.url
93         return instance.get_absolute_url()
94 
95     def get_organisation(self, instance):
96         return instance.organisation.name
97 
98     def get_tile_image(self, instance):
99         image_url = ''
100         if instance.tile_image:
101             image = get_thumbnailer(instance.tile_image)['project_tile']
102             image_url = image.url
103         return image_url
104 
105     def get_point_label(self, instance):
106         return ''
107 
108     def get_cost(self, instance):
109         return ''
110 
111     def get_status(self, instance):
112         if instance.phases.active_phases() or instance.phases.future_phases():
113             return 2
114         return 3
115 
116     def get_participation(self, instance):
117         return 1
118 
119     def get_participation_display(self, instance):
120         return _('Yes')
121 
122     def get_future_phase(self, instance):
123         if (instance.future_phases and
124                 instance.future_phases.first().start_date):
125             return str(
126                 instance.future_phases.first().start_date.date())
127         return False
128 
129     def get_active_phase(self, instance):
130         if instance.active_phase:
131             progress = instance.active_phase_progress
132             time_left = instance.time_left
133             return [progress, time_left]
134         return False
135 
136     def get_past_phase(self, instance):
137         if instance.phases.past_phases():
138             return True
139         return False
140 
141     def get_participation_string(self, instance):
142         participation_string, participation_active = \
143             self._get_participation_status_project(instance)
144         return str(participation_string)
145 
146     def get_participation_active(self, instance):
147         participation_string, participation_active = \
148             self._get_participation_status_project(instance)
149         return participation_active
150 
151     def get_plan_url(self, instance):
152         if instance.plans.exists():
153             return instance.plans.first().get_absolute_url()
154         return None
155 
156     def get_plan_title(self, instance):
157         if instance.plans.exists():
158             return instance.plans.first().title
159         return None
160 
161 
162 class PlanSerializer(serializers.ModelSerializer, CommonFields):
163     type = serializers.SerializerMethodField()
164     subtype = serializers.SerializerMethodField()
165     url = serializers.SerializerMethodField()
166     district = serializers.SerializerMethodField()
167     point = serializers.SerializerMethodField()
168     participation_active = serializers.SerializerMethodField()
169     participation_string = serializers.SerializerMethodField()
170     published_projects_count = serializers.SerializerMethodField()
171 
172     class Meta:
173         model = Plan
174         fields = ['type', 'subtype', 'title', 'url',
175                   'organisation', 'point',
176                   'point_label', 'cost',
177                   'district', 'topic', 'status',
178                   'participation',
179                   'participation_string',
180                   'participation_active',
181                   'published_projects_count']
182 
183     def get_subtype(self, instance):
184         return 'plan'
185 
186     def _get_participation_string(self, projects):
187         future_phase = None
188         for project in projects:
189             phases = project.phases
190             if phases.active_phases():
191                 return _('running')
192             if phases.future_phases() and \
193                phases.future_phases().first().start_date:
194                 date = phases.future_phases().first().start_date
195                 if not future_phase:
196                     future_phase = date
197                 else:
198                     if date < future_phase:
199                         future_phase = date
200 
201         if future_phase:
202             return _('starts at {}').format(future_phase.date())
203 
204     def _get_participation_status_plan(self, item):
205         projects = item.projects.all() \
206             .filter(is_draft=False,
207                     is_archived=False,
208                     is_public=True)
209         if not projects:
210             return item.get_participation_display(), False
211         else:
212             participation_string = self._get_participation_string(projects)
213             if participation_string:
214                 return participation_string, True
215             else:
216                 return item.get_participation_display(), False
217 
218     def get_type(self, instance):
219         return 'plan'
220 
221     def get_url(self, instance):
222         return instance.get_absolute_url()
223 
224     def get_published_projects_count(self, instance):
225         return instance.published_projects.count()
226 
227     def get_participation_string(self, instance):
228         participation_string, participation_active = \
229             self._get_participation_status_plan(instance)
230         return str(participation_string)
231 
232     def get_participation_active(self, instance):
233         participation_string, participation_active = \
234             self._get_participation_status_plan(instance)
235         return participation_active
236
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/meinberlin/apps/plans/serializers.py b/meinberlin/apps/plans/serializers.py
--- a/meinberlin/apps/plans/serializers.py
+++ b/meinberlin/apps/plans/serializers.py
@@ -45,6 +45,7 @@
     tile_image = serializers.SerializerMethodField()
     plan_url = serializers.SerializerMethodField()
     plan_title = serializers.SerializerMethodField()
+    published_projects_count = serializers.SerializerMethodField()
 
     class Meta:
         model = Project
@@ -58,7 +59,8 @@
                   'participation_active',
                   'participation', 'participation_display', 'description',
                   'future_phase', 'active_phase',
-                  'past_phase', 'plan_url', 'plan_title']
+                  'past_phase', 'plan_url', 'plan_title',
+                  'published_projects_count']
 
     def _get_participation_status_project(self, instance):
         if instance.phases.active_phases():
@@ -158,6 +160,10 @@
             return instance.plans.first().title
         return None
 
+    def get_published_projects_count(self, instance):
+        if hasattr(instance, 'projectcontainer') and instance.projectcontainer:
+            return instance.projectcontainer.active_project_count
+
 
 class PlanSerializer(serializers.ModelSerializer, CommonFields):
     type = serializers.SerializerMethodField()

{"golden_diff": "diff --git a/meinberlin/apps/plans/serializers.py b/meinberlin/apps/plans/serializers.py\n--- a/meinberlin/apps/plans/serializers.py\n+++ b/meinberlin/apps/plans/serializers.py\n@@ -45,6 +45,7 @@\n     tile_image = serializers.SerializerMethodField()\n     plan_url = serializers.SerializerMethodField()\n     plan_title = serializers.SerializerMethodField()\n+    published_projects_count = serializers.SerializerMethodField()\n \n     class Meta:\n         model = Project\n@@ -58,7 +59,8 @@\n                   'participation_active',\n                   'participation', 'participation_display', 'description',\n                   'future_phase', 'active_phase',\n-                  'past_phase', 'plan_url', 'plan_title']\n+                  'past_phase', 'plan_url', 'plan_title',\n+                  'published_projects_count']\n \n     def _get_participation_status_project(self, instance):\n         if instance.phases.active_phases():\n@@ -158,6 +160,10 @@\n             return instance.plans.first().title\n         return None\n \n+    def get_published_projects_count(self, instance):\n+        if hasattr(instance, 'projectcontainer') and instance.projectcontainer:\n+            return instance.projectcontainer.active_project_count\n+\n \n class PlanSerializer(serializers.ModelSerializer, CommonFields):\n     type = serializers.SerializerMethodField()\n", "issue": "Container tile does not show number of projects \n\n", "before_files": [{"content": "from django.utils.translation import ugettext as _\nfrom easy_thumbnails.files import get_thumbnailer\nfrom rest_framework import serializers\n\nfrom adhocracy4.projects.models import Project\nfrom meinberlin.apps.projects import get_project_type\n\nfrom .models import Plan\n\n\nclass CommonFields:\n\n    def get_district(self, instance):\n        city_wide = _('City wide')\n        district_name = str(city_wide)\n        if instance.administrative_district:\n            district_name = instance.administrative_district.name\n        return district_name\n\n    def get_point(self, instance):\n        point = instance.point\n        if not point:\n            point = ''\n        return point\n\n\nclass ProjectSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    title = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    point_label = serializers.SerializerMethodField()\n    cost = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    status = serializers.SerializerMethodField()\n    participation = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    participation_display = serializers.SerializerMethodField()\n    future_phase = serializers.SerializerMethodField()\n    active_phase = serializers.SerializerMethodField()\n    past_phase = serializers.SerializerMethodField()\n    tile_image = serializers.SerializerMethodField()\n    plan_url = serializers.SerializerMethodField()\n    plan_title = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Project\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'tile_image',\n                  'tile_image_copyright',\n                  'point', 'point_label', 'cost',\n                  'district', 'topic',\n                  'status',\n                  'participation_string',\n                  'participation_active',\n                  'participation', 'participation_display', 'description',\n                  'future_phase', 'active_phase',\n                  'past_phase', 'plan_url', 'plan_title']\n\n    def _get_participation_status_project(self, instance):\n        if instance.phases.active_phases():\n            return _('running'), True\n        elif instance.phases.future_phases():\n            try:\n                return (_('starts at {}').format\n                        (instance.phases.future_phases().first().\n                         start_date.date()),\n                        True)\n            except AttributeError:\n                return (_('starts in the future'),\n                        True)\n        else:\n            return _('done'), False\n\n    def get_type(self, instance):\n        return 'project'\n\n    def get_subtype(self, instance):\n        subtype = get_project_type(instance)\n        if subtype in ('external', 'bplan'):\n            return 'external'\n        return subtype\n\n    def get_title(self, instance):\n        return instance.name\n\n    def get_url(self, instance):\n        if get_project_type(instance) in ('external', 'bplan'):\n            return instance.externalproject.url\n        return instance.get_absolute_url()\n\n    def get_organisation(self, instance):\n        return instance.organisation.name\n\n    def get_tile_image(self, instance):\n        image_url = ''\n        if instance.tile_image:\n            image = get_thumbnailer(instance.tile_image)['project_tile']\n            image_url = image.url\n        return image_url\n\n    def get_point_label(self, instance):\n        return ''\n\n    def get_cost(self, instance):\n        return ''\n\n    def get_status(self, instance):\n        if instance.phases.active_phases() or instance.phases.future_phases():\n            return 2\n        return 3\n\n    def get_participation(self, instance):\n        return 1\n\n    def get_participation_display(self, instance):\n        return _('Yes')\n\n    def get_future_phase(self, instance):\n        if (instance.future_phases and\n                instance.future_phases.first().start_date):\n            return str(\n                instance.future_phases.first().start_date.date())\n        return False\n\n    def get_active_phase(self, instance):\n        if instance.active_phase:\n            progress = instance.active_phase_progress\n            time_left = instance.time_left\n            return [progress, time_left]\n        return False\n\n    def get_past_phase(self, instance):\n        if instance.phases.past_phases():\n            return True\n        return False\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return participation_active\n\n    def get_plan_url(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().get_absolute_url()\n        return None\n\n    def get_plan_title(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().title\n        return None\n\n\nclass PlanSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Plan\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'point',\n                  'point_label', 'cost',\n                  'district', 'topic', 'status',\n                  'participation',\n                  'participation_string',\n                  'participation_active',\n                  'published_projects_count']\n\n    def get_subtype(self, instance):\n        return 'plan'\n\n    def _get_participation_string(self, projects):\n        future_phase = None\n        for project in projects:\n            phases = project.phases\n            if phases.active_phases():\n                return _('running')\n            if phases.future_phases() and \\\n               phases.future_phases().first().start_date:\n                date = phases.future_phases().first().start_date\n                if not future_phase:\n                    future_phase = date\n                else:\n                    if date < future_phase:\n                        future_phase = date\n\n        if future_phase:\n            return _('starts at {}').format(future_phase.date())\n\n    def _get_participation_status_plan(self, item):\n        projects = item.projects.all() \\\n            .filter(is_draft=False,\n                    is_archived=False,\n                    is_public=True)\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            participation_string = self._get_participation_string(projects)\n            if participation_string:\n                return participation_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_type(self, instance):\n        return 'plan'\n\n    def get_url(self, instance):\n        return instance.get_absolute_url()\n\n    def get_published_projects_count(self, instance):\n        return instance.published_projects.count()\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return participation_active\n", "path": "meinberlin/apps/plans/serializers.py"}], "after_files": [{"content": "from django.utils.translation import ugettext as _\nfrom easy_thumbnails.files import get_thumbnailer\nfrom rest_framework import serializers\n\nfrom adhocracy4.projects.models import Project\nfrom meinberlin.apps.projects import get_project_type\n\nfrom .models import Plan\n\n\nclass CommonFields:\n\n    def get_district(self, instance):\n        city_wide = _('City wide')\n        district_name = str(city_wide)\n        if instance.administrative_district:\n            district_name = instance.administrative_district.name\n        return district_name\n\n    def get_point(self, instance):\n        point = instance.point\n        if not point:\n            point = ''\n        return point\n\n\nclass ProjectSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    title = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    point_label = serializers.SerializerMethodField()\n    cost = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    status = serializers.SerializerMethodField()\n    participation = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    participation_display = serializers.SerializerMethodField()\n    future_phase = serializers.SerializerMethodField()\n    active_phase = serializers.SerializerMethodField()\n    past_phase = serializers.SerializerMethodField()\n    tile_image = serializers.SerializerMethodField()\n    plan_url = serializers.SerializerMethodField()\n    plan_title = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Project\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'tile_image',\n                  'tile_image_copyright',\n                  'point', 'point_label', 'cost',\n                  'district', 'topic',\n                  'status',\n                  'participation_string',\n                  'participation_active',\n                  'participation', 'participation_display', 'description',\n                  'future_phase', 'active_phase',\n                  'past_phase', 'plan_url', 'plan_title',\n                  'published_projects_count']\n\n    def _get_participation_status_project(self, instance):\n        if instance.phases.active_phases():\n            return _('running'), True\n        elif instance.phases.future_phases():\n            try:\n                return (_('starts at {}').format\n                        (instance.phases.future_phases().first().\n                         start_date.date()),\n                        True)\n            except AttributeError:\n                return (_('starts in the future'),\n                        True)\n        else:\n            return _('done'), False\n\n    def get_type(self, instance):\n        return 'project'\n\n    def get_subtype(self, instance):\n        subtype = get_project_type(instance)\n        if subtype in ('external', 'bplan'):\n            return 'external'\n        return subtype\n\n    def get_title(self, instance):\n        return instance.name\n\n    def get_url(self, instance):\n        if get_project_type(instance) in ('external', 'bplan'):\n            return instance.externalproject.url\n        return instance.get_absolute_url()\n\n    def get_organisation(self, instance):\n        return instance.organisation.name\n\n    def get_tile_image(self, instance):\n        image_url = ''\n        if instance.tile_image:\n            image = get_thumbnailer(instance.tile_image)['project_tile']\n            image_url = image.url\n        return image_url\n\n    def get_point_label(self, instance):\n        return ''\n\n    def get_cost(self, instance):\n        return ''\n\n    def get_status(self, instance):\n        if instance.phases.active_phases() or instance.phases.future_phases():\n            return 2\n        return 3\n\n    def get_participation(self, instance):\n        return 1\n\n    def get_participation_display(self, instance):\n        return _('Yes')\n\n    def get_future_phase(self, instance):\n        if (instance.future_phases and\n                instance.future_phases.first().start_date):\n            return str(\n                instance.future_phases.first().start_date.date())\n        return False\n\n    def get_active_phase(self, instance):\n        if instance.active_phase:\n            progress = instance.active_phase_progress\n            time_left = instance.time_left\n            return [progress, time_left]\n        return False\n\n    def get_past_phase(self, instance):\n        if instance.phases.past_phases():\n            return True\n        return False\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return participation_active\n\n    def get_plan_url(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().get_absolute_url()\n        return None\n\n    def get_plan_title(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().title\n        return None\n\n    def get_published_projects_count(self, instance):\n        if hasattr(instance, 'projectcontainer') and instance.projectcontainer:\n            return instance.projectcontainer.active_project_count\n\n\nclass PlanSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Plan\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'point',\n                  'point_label', 'cost',\n                  'district', 'topic', 'status',\n                  'participation',\n                  'participation_string',\n                  'participation_active',\n                  'published_projects_count']\n\n    def get_subtype(self, instance):\n        return 'plan'\n\n    def _get_participation_string(self, projects):\n        future_phase = None\n        for project in projects:\n            phases = project.phases\n            if phases.active_phases():\n                return _('running')\n            if phases.future_phases() and \\\n               phases.future_phases().first().start_date:\n                date = phases.future_phases().first().start_date\n                if not future_phase:\n                    future_phase = date\n                else:\n                    if date < future_phase:\n                        future_phase = date\n\n        if future_phase:\n            return _('starts at {}').format(future_phase.date())\n\n    def _get_participation_status_plan(self, item):\n        projects = item.projects.all() \\\n            .filter(is_draft=False,\n                    is_archived=False,\n                    is_public=True)\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            participation_string = self._get_participation_string(projects)\n            if participation_string:\n                return participation_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_type(self, instance):\n        return 'plan'\n\n    def get_url(self, instance):\n        return instance.get_absolute_url()\n\n    def get_published_projects_count(self, instance):\n        return instance.published_projects.count()\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return participation_active\n", "path": "meinberlin/apps/plans/serializers.py"}]}