We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Les derniers sujets suivis cette semaine ne le sont pas forcément.
A l'heure ou je poste cette issue, on est lundi et dans mes sujets suivis j'ai des sujets suivis de : 
- aujourd'hui : normal
- hier (dimanche) : normal
- cette semaine : il y'a un problème de vocable ici. Car "cette semaine" à commencée en fait aujourd'hui. Le code lui veut plutôt parler des "7 derniers jours".

Donc j'ignore la bonne façon de faire ici ? renommer le "cette semaine" ou modifier le comportement pour n'avoir que ce qui s'est passé cette semaine ?

Mais dans tout les cas l'affichage ne correspond pas à la réalité. Au vu du code, le problème est aussi présent pour "Ce mois" qui devrait plutôt s'appeler "Les 30 derniers jours" pour être cohérent avec la réalité.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `zds/utils/templatetags/interventions.py`
Content:
```
1 # coding: utf-8
2 
3 from datetime import datetime, timedelta
4 import time
5 
6 from django import template
7 from django.db.models import F
8 
9 from zds.forum.models import TopicFollowed, never_read as never_read_topic, Post, TopicRead
10 from zds.mp.models import PrivateTopic
11 
12 from zds.utils.models import Alert
13 from zds.tutorialv2.models.models_database import ContentRead, ContentReaction
14 
15 register = template.Library()
16 
17 
18 @register.filter('is_read')
19 def is_read(topic):
20     if never_read_topic(topic):
21         return False
22     else:
23         return True
24 
25 
26 @register.filter('humane_delta')
27 def humane_delta(value):
28     # mapping between label day and key
29     const = {1: "Aujourd'hui", 2: "Hier", 3: "Cette semaine", 4: "Ce mois-ci", 5: "Cette année"}
30 
31     return const[value]
32 
33 
34 @register.filter('followed_topics')
35 def followed_topics(user):
36     topicsfollowed = TopicFollowed.objects.select_related("topic").filter(user=user)\
37         .order_by('-topic__last_message__pubdate')[:10]
38     # This period is a map for link a moment (Today, yesterday, this week, this month, etc.) with
39     # the number of days for which we can say we're still in the period
40     # for exemple, the tuple (2, 1) means for the period "2" corresponding to "Yesterday" according
41     # to humane_delta, means if your pubdate hasn't exceeded one day, we are always at "Yesterday"
42     # Number is use for index for sort map easily
43     periods = ((1, 0), (2, 1), (3, 7), (4, 30), (5, 360))
44     topics = {}
45     for tfollowed in topicsfollowed:
46         for period in periods:
47             if tfollowed.topic.last_message.pubdate.date() >= (datetime.now() - timedelta(days=int(period[1]),
48                                                                                           hours=0,
49                                                                                           minutes=0,
50                                                                                           seconds=0)).date():
51                 if period[0] in topics:
52                     topics[period[0]].append(tfollowed.topic)
53                 else:
54                     topics[period[0]] = [tfollowed.topic]
55                 break
56     return topics
57 
58 
59 def comp(dated_element1, dated_element2):
60     version1 = int(time.mktime(dated_element1['pubdate'].timetuple()))
61     version2 = int(time.mktime(dated_element2['pubdate'].timetuple()))
62     if version1 > version2:
63         return -1
64     elif version1 < version2:
65         return 1
66     else:
67         return 0
68 
69 
70 @register.filter('interventions_topics')
71 def interventions_topics(user):
72     topicsfollowed = TopicFollowed.objects.filter(user=user).values("topic").distinct().all()
73 
74     topics_never_read = TopicRead.objects\
75         .filter(user=user)\
76         .filter(topic__in=topicsfollowed)\
77         .select_related("topic")\
78         .exclude(post=F('topic__last_message')).all()
79 
80     content_followed_pk = ContentReaction.objects\
81         .filter(author=user, related_content__public_version__isnull=False)\
82         .values_list('related_content__pk', flat=True)
83 
84     content_to_read = ContentRead.objects\
85         .select_related('note')\
86         .select_related('note__author')\
87         .select_related('content')\
88         .select_related('note__related_content__public_version')\
89         .filter(user=user)\
90         .exclude(note__pk=F('content__last_note__pk')).all()
91 
92     posts_unread = []
93 
94     for top in topics_never_read:
95         content = top.topic.first_unread_post()
96         if content is None:
97             content = top.topic.last_message
98         posts_unread.append({'pubdate': content.pubdate,
99                              'author': content.author,
100                              'title': top.topic.title,
101                              'url': content.get_absolute_url()})
102 
103     for content_read in content_to_read:
104         content = content_read.content
105         if content.pk not in content_followed_pk and user not in content.authors.all():
106             continue
107         reaction = content.first_unread_note()
108         if reaction is None:
109             reaction = content.first_note()
110         if reaction is None:
111             continue
112         posts_unread.append({'pubdate': reaction.pubdate,
113                              'author': reaction.author,
114                              'title': content.title,
115                              'url': reaction.get_absolute_url()})
116 
117     posts_unread.sort(cmp=comp)
118 
119     return posts_unread
120 
121 
122 @register.filter('interventions_privatetopics')
123 def interventions_privatetopics(user):
124 
125     # Raw query because ORM doesn't seems to allow this kind of "left outer join" clauses.
126     # Parameters = list with 3x the same ID because SQLite backend doesn't allow map parameters.
127     privatetopics_unread = PrivateTopic.objects.raw(
128         '''
129         select distinct t.*
130         from mp_privatetopic t
131         left outer join mp_privatetopic_participants p on p.privatetopic_id = t.id
132         left outer join mp_privatetopicread r on r.user_id = %s and r.privatepost_id = t.last_message_id
133         where (t.author_id = %s or p.user_id = %s)
134           and r.id is null
135         order by t.pubdate desc''',
136         [user.id, user.id, user.id])
137 
138     # "total" re-do the query, but there is no other way to get the length as __len__ is not available on raw queries.
139     topics = list(privatetopics_unread)
140     return {'unread': topics, 'total': len(topics)}
141 
142 
143 @register.filter(name='alerts_list')
144 def alerts_list(user):
145     total = []
146     alerts = Alert.objects.select_related('author', 'comment').all().order_by('-pubdate')[:10]
147     nb_alerts = Alert.objects.count()
148     for alert in alerts:
149         if alert.scope == Alert.FORUM:
150             post = Post.objects.select_related('topic').get(pk=alert.comment.pk)
151             total.append({'title': post.topic.title,
152                           'url': post.get_absolute_url(),
153                           'pubdate': alert.pubdate,
154                           'author': alert.author,
155                           'text': alert.text})
156 
157         elif alert.scope == Alert.CONTENT:
158             note = ContentReaction.objects.select_related('related_content').get(pk=alert.comment.pk)
159             total.append({'title': note.related_content.title,
160                           'url': note.get_absolute_url(),
161                           'pubdate': alert.pubdate,
162                           'author': alert.author,
163                           'text': alert.text})
164 
165     return {'alerts': total, 'nb_alerts': nb_alerts}
166
```
--- 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/zds/utils/templatetags/interventions.py b/zds/utils/templatetags/interventions.py
--- a/zds/utils/templatetags/interventions.py
+++ b/zds/utils/templatetags/interventions.py
@@ -5,10 +5,10 @@
 
 from django import template
 from django.db.models import F
+from django.utils.translation import ugettext_lazy as _
 
 from zds.forum.models import TopicFollowed, never_read as never_read_topic, Post, TopicRead
 from zds.mp.models import PrivateTopic
-
 from zds.utils.models import Alert
 from zds.tutorialv2.models.models_database import ContentRead, ContentReaction
 
@@ -25,8 +25,19 @@
 
 @register.filter('humane_delta')
 def humane_delta(value):
-    # mapping between label day and key
-    const = {1: "Aujourd'hui", 2: "Hier", 3: "Cette semaine", 4: "Ce mois-ci", 5: "Cette année"}
+    """
+    Mapping between label day and key
+
+    :param int value:
+    :return: string
+    """
+    const = {
+        1: _("Aujourd'hui"),
+        2: _("Hier"),
+        3: _("Les 7 derniers jours"),
+        4: _("Les 30 derniers jours"),
+        5: _("Plus ancien")
+    }
 
     return const[value]

{"golden_diff": "diff --git a/zds/utils/templatetags/interventions.py b/zds/utils/templatetags/interventions.py\n--- a/zds/utils/templatetags/interventions.py\n+++ b/zds/utils/templatetags/interventions.py\n@@ -5,10 +5,10 @@\n \n from django import template\n from django.db.models import F\n+from django.utils.translation import ugettext_lazy as _\n \n from zds.forum.models import TopicFollowed, never_read as never_read_topic, Post, TopicRead\n from zds.mp.models import PrivateTopic\n-\n from zds.utils.models import Alert\n from zds.tutorialv2.models.models_database import ContentRead, ContentReaction\n \n@@ -25,8 +25,19 @@\n \n @register.filter('humane_delta')\n def humane_delta(value):\n-    # mapping between label day and key\n-    const = {1: \"Aujourd'hui\", 2: \"Hier\", 3: \"Cette semaine\", 4: \"Ce mois-ci\", 5: \"Cette ann\u00e9e\"}\n+    \"\"\"\n+    Mapping between label day and key\n+\n+    :param int value:\n+    :return: string\n+    \"\"\"\n+    const = {\n+        1: _(\"Aujourd'hui\"),\n+        2: _(\"Hier\"),\n+        3: _(\"Les 7 derniers jours\"),\n+        4: _(\"Les 30 derniers jours\"),\n+        5: _(\"Plus ancien\")\n+    }\n \n     return const[value]\n", "issue": "Les derniers sujets suivis cette semaine ne le sont pas forc\u00e9ment.\nA l'heure ou je poste cette issue, on est lundi et dans mes sujets suivis j'ai des sujets suivis de : \n- aujourd'hui : normal\n- hier (dimanche) : normal\n- cette semaine : il y'a un probl\u00e8me de vocable ici. Car \"cette semaine\" \u00e0 commenc\u00e9e en fait aujourd'hui. Le code lui veut plut\u00f4t parler des \"7 derniers jours\".\n\nDonc j'ignore la bonne fa\u00e7on de faire ici ? renommer le \"cette semaine\" ou modifier le comportement pour n'avoir que ce qui s'est pass\u00e9 cette semaine ?\n\nMais dans tout les cas l'affichage ne correspond pas \u00e0 la r\u00e9alit\u00e9. Au vu du code, le probl\u00e8me est aussi pr\u00e9sent pour \"Ce mois\" qui devrait plut\u00f4t s'appeler \"Les 30 derniers jours\" pour \u00eatre coh\u00e9rent avec la r\u00e9alit\u00e9.\n\n", "before_files": [{"content": "# coding: utf-8\n\nfrom datetime import datetime, timedelta\nimport time\n\nfrom django import template\nfrom django.db.models import F\n\nfrom zds.forum.models import TopicFollowed, never_read as never_read_topic, Post, TopicRead\nfrom zds.mp.models import PrivateTopic\n\nfrom zds.utils.models import Alert\nfrom zds.tutorialv2.models.models_database import ContentRead, ContentReaction\n\nregister = template.Library()\n\n\n@register.filter('is_read')\ndef is_read(topic):\n    if never_read_topic(topic):\n        return False\n    else:\n        return True\n\n\n@register.filter('humane_delta')\ndef humane_delta(value):\n    # mapping between label day and key\n    const = {1: \"Aujourd'hui\", 2: \"Hier\", 3: \"Cette semaine\", 4: \"Ce mois-ci\", 5: \"Cette ann\u00e9e\"}\n\n    return const[value]\n\n\n@register.filter('followed_topics')\ndef followed_topics(user):\n    topicsfollowed = TopicFollowed.objects.select_related(\"topic\").filter(user=user)\\\n        .order_by('-topic__last_message__pubdate')[:10]\n    # This period is a map for link a moment (Today, yesterday, this week, this month, etc.) with\n    # the number of days for which we can say we're still in the period\n    # for exemple, the tuple (2, 1) means for the period \"2\" corresponding to \"Yesterday\" according\n    # to humane_delta, means if your pubdate hasn't exceeded one day, we are always at \"Yesterday\"\n    # Number is use for index for sort map easily\n    periods = ((1, 0), (2, 1), (3, 7), (4, 30), (5, 360))\n    topics = {}\n    for tfollowed in topicsfollowed:\n        for period in periods:\n            if tfollowed.topic.last_message.pubdate.date() >= (datetime.now() - timedelta(days=int(period[1]),\n                                                                                          hours=0,\n                                                                                          minutes=0,\n                                                                                          seconds=0)).date():\n                if period[0] in topics:\n                    topics[period[0]].append(tfollowed.topic)\n                else:\n                    topics[period[0]] = [tfollowed.topic]\n                break\n    return topics\n\n\ndef comp(dated_element1, dated_element2):\n    version1 = int(time.mktime(dated_element1['pubdate'].timetuple()))\n    version2 = int(time.mktime(dated_element2['pubdate'].timetuple()))\n    if version1 > version2:\n        return -1\n    elif version1 < version2:\n        return 1\n    else:\n        return 0\n\n\n@register.filter('interventions_topics')\ndef interventions_topics(user):\n    topicsfollowed = TopicFollowed.objects.filter(user=user).values(\"topic\").distinct().all()\n\n    topics_never_read = TopicRead.objects\\\n        .filter(user=user)\\\n        .filter(topic__in=topicsfollowed)\\\n        .select_related(\"topic\")\\\n        .exclude(post=F('topic__last_message')).all()\n\n    content_followed_pk = ContentReaction.objects\\\n        .filter(author=user, related_content__public_version__isnull=False)\\\n        .values_list('related_content__pk', flat=True)\n\n    content_to_read = ContentRead.objects\\\n        .select_related('note')\\\n        .select_related('note__author')\\\n        .select_related('content')\\\n        .select_related('note__related_content__public_version')\\\n        .filter(user=user)\\\n        .exclude(note__pk=F('content__last_note__pk')).all()\n\n    posts_unread = []\n\n    for top in topics_never_read:\n        content = top.topic.first_unread_post()\n        if content is None:\n            content = top.topic.last_message\n        posts_unread.append({'pubdate': content.pubdate,\n                             'author': content.author,\n                             'title': top.topic.title,\n                             'url': content.get_absolute_url()})\n\n    for content_read in content_to_read:\n        content = content_read.content\n        if content.pk not in content_followed_pk and user not in content.authors.all():\n            continue\n        reaction = content.first_unread_note()\n        if reaction is None:\n            reaction = content.first_note()\n        if reaction is None:\n            continue\n        posts_unread.append({'pubdate': reaction.pubdate,\n                             'author': reaction.author,\n                             'title': content.title,\n                             'url': reaction.get_absolute_url()})\n\n    posts_unread.sort(cmp=comp)\n\n    return posts_unread\n\n\n@register.filter('interventions_privatetopics')\ndef interventions_privatetopics(user):\n\n    # Raw query because ORM doesn't seems to allow this kind of \"left outer join\" clauses.\n    # Parameters = list with 3x the same ID because SQLite backend doesn't allow map parameters.\n    privatetopics_unread = PrivateTopic.objects.raw(\n        '''\n        select distinct t.*\n        from mp_privatetopic t\n        left outer join mp_privatetopic_participants p on p.privatetopic_id = t.id\n        left outer join mp_privatetopicread r on r.user_id = %s and r.privatepost_id = t.last_message_id\n        where (t.author_id = %s or p.user_id = %s)\n          and r.id is null\n        order by t.pubdate desc''',\n        [user.id, user.id, user.id])\n\n    # \"total\" re-do the query, but there is no other way to get the length as __len__ is not available on raw queries.\n    topics = list(privatetopics_unread)\n    return {'unread': topics, 'total': len(topics)}\n\n\n@register.filter(name='alerts_list')\ndef alerts_list(user):\n    total = []\n    alerts = Alert.objects.select_related('author', 'comment').all().order_by('-pubdate')[:10]\n    nb_alerts = Alert.objects.count()\n    for alert in alerts:\n        if alert.scope == Alert.FORUM:\n            post = Post.objects.select_related('topic').get(pk=alert.comment.pk)\n            total.append({'title': post.topic.title,\n                          'url': post.get_absolute_url(),\n                          'pubdate': alert.pubdate,\n                          'author': alert.author,\n                          'text': alert.text})\n\n        elif alert.scope == Alert.CONTENT:\n            note = ContentReaction.objects.select_related('related_content').get(pk=alert.comment.pk)\n            total.append({'title': note.related_content.title,\n                          'url': note.get_absolute_url(),\n                          'pubdate': alert.pubdate,\n                          'author': alert.author,\n                          'text': alert.text})\n\n    return {'alerts': total, 'nb_alerts': nb_alerts}\n", "path": "zds/utils/templatetags/interventions.py"}], "after_files": [{"content": "# coding: utf-8\n\nfrom datetime import datetime, timedelta\nimport time\n\nfrom django import template\nfrom django.db.models import F\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom zds.forum.models import TopicFollowed, never_read as never_read_topic, Post, TopicRead\nfrom zds.mp.models import PrivateTopic\nfrom zds.utils.models import Alert\nfrom zds.tutorialv2.models.models_database import ContentRead, ContentReaction\n\nregister = template.Library()\n\n\n@register.filter('is_read')\ndef is_read(topic):\n    if never_read_topic(topic):\n        return False\n    else:\n        return True\n\n\n@register.filter('humane_delta')\ndef humane_delta(value):\n    \"\"\"\n    Mapping between label day and key\n\n    :param int value:\n    :return: string\n    \"\"\"\n    const = {\n        1: _(\"Aujourd'hui\"),\n        2: _(\"Hier\"),\n        3: _(\"Les 7 derniers jours\"),\n        4: _(\"Les 30 derniers jours\"),\n        5: _(\"Plus ancien\")\n    }\n\n    return const[value]\n\n\n@register.filter('followed_topics')\ndef followed_topics(user):\n    topicsfollowed = TopicFollowed.objects.select_related(\"topic\").filter(user=user)\\\n        .order_by('-topic__last_message__pubdate')[:10]\n    # This period is a map for link a moment (Today, yesterday, this week, this month, etc.) with\n    # the number of days for which we can say we're still in the period\n    # for exemple, the tuple (2, 1) means for the period \"2\" corresponding to \"Yesterday\" according\n    # to humane_delta, means if your pubdate hasn't exceeded one day, we are always at \"Yesterday\"\n    # Number is use for index for sort map easily\n    periods = ((1, 0), (2, 1), (3, 7), (4, 30), (5, 360))\n    topics = {}\n    for tfollowed in topicsfollowed:\n        for period in periods:\n            if tfollowed.topic.last_message.pubdate.date() >= (datetime.now() - timedelta(days=int(period[1]),\n                                                                                          hours=0,\n                                                                                          minutes=0,\n                                                                                          seconds=0)).date():\n                if period[0] in topics:\n                    topics[period[0]].append(tfollowed.topic)\n                else:\n                    topics[period[0]] = [tfollowed.topic]\n                break\n    return topics\n\n\ndef comp(dated_element1, dated_element2):\n    version1 = int(time.mktime(dated_element1['pubdate'].timetuple()))\n    version2 = int(time.mktime(dated_element2['pubdate'].timetuple()))\n    if version1 > version2:\n        return -1\n    elif version1 < version2:\n        return 1\n    else:\n        return 0\n\n\n@register.filter('interventions_topics')\ndef interventions_topics(user):\n    topicsfollowed = TopicFollowed.objects.filter(user=user).values(\"topic\").distinct().all()\n\n    topics_never_read = TopicRead.objects\\\n        .filter(user=user)\\\n        .filter(topic__in=topicsfollowed)\\\n        .select_related(\"topic\")\\\n        .exclude(post=F('topic__last_message')).all()\n\n    content_followed_pk = ContentReaction.objects\\\n        .filter(author=user, related_content__public_version__isnull=False)\\\n        .values_list('related_content__pk', flat=True)\n\n    content_to_read = ContentRead.objects\\\n        .select_related('note')\\\n        .select_related('note__author')\\\n        .select_related('content')\\\n        .select_related('note__related_content__public_version')\\\n        .filter(user=user)\\\n        .exclude(note__pk=F('content__last_note__pk')).all()\n\n    posts_unread = []\n\n    for top in topics_never_read:\n        content = top.topic.first_unread_post()\n        if content is None:\n            content = top.topic.last_message\n        posts_unread.append({'pubdate': content.pubdate,\n                             'author': content.author,\n                             'title': top.topic.title,\n                             'url': content.get_absolute_url()})\n\n    for content_read in content_to_read:\n        content = content_read.content\n        if content.pk not in content_followed_pk and user not in content.authors.all():\n            continue\n        reaction = content.first_unread_note()\n        if reaction is None:\n            reaction = content.first_note()\n        if reaction is None:\n            continue\n        posts_unread.append({'pubdate': reaction.pubdate,\n                             'author': reaction.author,\n                             'title': content.title,\n                             'url': reaction.get_absolute_url()})\n\n    posts_unread.sort(cmp=comp)\n\n    return posts_unread\n\n\n@register.filter('interventions_privatetopics')\ndef interventions_privatetopics(user):\n\n    # Raw query because ORM doesn't seems to allow this kind of \"left outer join\" clauses.\n    # Parameters = list with 3x the same ID because SQLite backend doesn't allow map parameters.\n    privatetopics_unread = PrivateTopic.objects.raw(\n        '''\n        select distinct t.*\n        from mp_privatetopic t\n        left outer join mp_privatetopic_participants p on p.privatetopic_id = t.id\n        left outer join mp_privatetopicread r on r.user_id = %s and r.privatepost_id = t.last_message_id\n        where (t.author_id = %s or p.user_id = %s)\n          and r.id is null\n        order by t.pubdate desc''',\n        [user.id, user.id, user.id])\n\n    # \"total\" re-do the query, but there is no other way to get the length as __len__ is not available on raw queries.\n    topics = list(privatetopics_unread)\n    return {'unread': topics, 'total': len(topics)}\n\n\n@register.filter(name='alerts_list')\ndef alerts_list(user):\n    total = []\n    alerts = Alert.objects.select_related('author', 'comment').all().order_by('-pubdate')[:10]\n    nb_alerts = Alert.objects.count()\n    for alert in alerts:\n        if alert.scope == Alert.FORUM:\n            post = Post.objects.select_related('topic').get(pk=alert.comment.pk)\n            total.append({'title': post.topic.title,\n                          'url': post.get_absolute_url(),\n                          'pubdate': alert.pubdate,\n                          'author': alert.author,\n                          'text': alert.text})\n\n        elif alert.scope == Alert.CONTENT:\n            note = ContentReaction.objects.select_related('related_content').get(pk=alert.comment.pk)\n            total.append({'title': note.related_content.title,\n                          'url': note.get_absolute_url(),\n                          'pubdate': alert.pubdate,\n                          'author': alert.author,\n                          'text': alert.text})\n\n    return {'alerts': total, 'nb_alerts': nb_alerts}\n", "path": "zds/utils/templatetags/interventions.py"}]}