We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Wrong penalty count in email
The counter in the penalty email is still wrong:

![screenshot from 2018-02-02 13-43-18](https://user-images.githubusercontent.com/1467188/35733820-208df2e4-081f-11e8-9903-3767cfedd43d.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lego/apps/feed/feed_handlers/penalty_handler.py`
Content:
```
1 from lego.apps.feed.activities import Activity
2 from lego.apps.feed.feed_handlers.base_handler import BaseHandler
3 from lego.apps.feed.feed_manager import feed_manager
4 from lego.apps.feed.feeds.notification_feed import NotificationFeed
5 from lego.apps.feed.registry import register_handler
6 from lego.apps.feed.verbs import PenaltyVerb
7 from lego.apps.users.models import Penalty
8 from lego.apps.users.notifications import PenaltyNotification
9 
10 
11 class PenaltyHandler(BaseHandler):
12     model = Penalty
13     manager = feed_manager
14 
15     def get_activity(self, penalty):
16         return Activity(
17             actor=penalty.source_event, verb=PenaltyVerb, object=penalty, target=penalty.user,
18             time=penalty.created_at, extra_context={
19                 'reason': penalty.reason,
20                 'weight': penalty.weight,
21                 'total': penalty.user.number_of_penalties()
22             }
23         )
24 
25     def handle_create(self, penalty):
26         activity = self.get_activity(penalty)
27         self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])
28 
29         # Send Notification
30         notification = PenaltyNotification(penalty.user, penalty=penalty)
31         notification.notify()
32 
33     def handle_update(self, penalty):
34         activity = self.get_activity(penalty)
35         self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])
36 
37     def handle_delete(self, penalty):
38         activity = self.get_activity(penalty)
39         self.manager.remove_activity(activity, [penalty.user.pk], [NotificationFeed])
40 
41 
42 register_handler(PenaltyHandler)
43
```

Path: `lego/apps/users/notifications.py`
Content:
```
1 from lego.apps.notifications.constants import PENALTY_CREATION
2 from lego.apps.notifications.notification import Notification
3 
4 
5 class PenaltyNotification(Notification):
6 
7     name = PENALTY_CREATION
8 
9     def generate_mail(self):
10         penalty = self.kwargs['penalty']
11 
12         return self._delay_mail(
13             to_email=self.user.email,
14             context={
15                 'name': self.user.full_name,
16                 'weight': penalty.weight,
17                 'event': penalty.source_event.title,
18                 'reason': penalty.reason,
19                 'total': self.user.number_of_penalties()
20             },
21             subject=f'Du har fått en ny prikk',
22             plain_template='users/email/penalty.txt',
23             html_template='users/email/penalty.html',
24         )
25 
26     def generate_push(self):
27         penalty = self.kwargs['penalty']
28 
29         return self._delay_push(
30             template='users/push/penalty.txt', context={
31                 'weight': penalty.weight,
32                 'event': penalty.source_event.title,
33             }, instance=penalty
34         )
35
```
--- 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/lego/apps/feed/feed_handlers/penalty_handler.py b/lego/apps/feed/feed_handlers/penalty_handler.py
--- a/lego/apps/feed/feed_handlers/penalty_handler.py
+++ b/lego/apps/feed/feed_handlers/penalty_handler.py
@@ -18,7 +18,6 @@
             time=penalty.created_at, extra_context={
                 'reason': penalty.reason,
                 'weight': penalty.weight,
-                'total': penalty.user.number_of_penalties()
             }
         )
 
diff --git a/lego/apps/users/notifications.py b/lego/apps/users/notifications.py
--- a/lego/apps/users/notifications.py
+++ b/lego/apps/users/notifications.py
@@ -16,7 +16,6 @@
                 'weight': penalty.weight,
                 'event': penalty.source_event.title,
                 'reason': penalty.reason,
-                'total': self.user.number_of_penalties()
             },
             subject=f'Du har fått en ny prikk',
             plain_template='users/email/penalty.txt',

{"golden_diff": "diff --git a/lego/apps/feed/feed_handlers/penalty_handler.py b/lego/apps/feed/feed_handlers/penalty_handler.py\n--- a/lego/apps/feed/feed_handlers/penalty_handler.py\n+++ b/lego/apps/feed/feed_handlers/penalty_handler.py\n@@ -18,7 +18,6 @@\n             time=penalty.created_at, extra_context={\n                 'reason': penalty.reason,\n                 'weight': penalty.weight,\n-                'total': penalty.user.number_of_penalties()\n             }\n         )\n \ndiff --git a/lego/apps/users/notifications.py b/lego/apps/users/notifications.py\n--- a/lego/apps/users/notifications.py\n+++ b/lego/apps/users/notifications.py\n@@ -16,7 +16,6 @@\n                 'weight': penalty.weight,\n                 'event': penalty.source_event.title,\n                 'reason': penalty.reason,\n-                'total': self.user.number_of_penalties()\n             },\n             subject=f'Du har f\u00e5tt en ny prikk',\n             plain_template='users/email/penalty.txt',\n", "issue": "Wrong penalty count in email\nThe counter in the penalty email is still wrong:\r\n\r\n![screenshot from 2018-02-02 13-43-18](https://user-images.githubusercontent.com/1467188/35733820-208df2e4-081f-11e8-9903-3767cfedd43d.png)\r\n\n", "before_files": [{"content": "from lego.apps.feed.activities import Activity\nfrom lego.apps.feed.feed_handlers.base_handler import BaseHandler\nfrom lego.apps.feed.feed_manager import feed_manager\nfrom lego.apps.feed.feeds.notification_feed import NotificationFeed\nfrom lego.apps.feed.registry import register_handler\nfrom lego.apps.feed.verbs import PenaltyVerb\nfrom lego.apps.users.models import Penalty\nfrom lego.apps.users.notifications import PenaltyNotification\n\n\nclass PenaltyHandler(BaseHandler):\n    model = Penalty\n    manager = feed_manager\n\n    def get_activity(self, penalty):\n        return Activity(\n            actor=penalty.source_event, verb=PenaltyVerb, object=penalty, target=penalty.user,\n            time=penalty.created_at, extra_context={\n                'reason': penalty.reason,\n                'weight': penalty.weight,\n                'total': penalty.user.number_of_penalties()\n            }\n        )\n\n    def handle_create(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n        # Send Notification\n        notification = PenaltyNotification(penalty.user, penalty=penalty)\n        notification.notify()\n\n    def handle_update(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n    def handle_delete(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.remove_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n\nregister_handler(PenaltyHandler)\n", "path": "lego/apps/feed/feed_handlers/penalty_handler.py"}, {"content": "from lego.apps.notifications.constants import PENALTY_CREATION\nfrom lego.apps.notifications.notification import Notification\n\n\nclass PenaltyNotification(Notification):\n\n    name = PENALTY_CREATION\n\n    def generate_mail(self):\n        penalty = self.kwargs['penalty']\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                'name': self.user.full_name,\n                'weight': penalty.weight,\n                'event': penalty.source_event.title,\n                'reason': penalty.reason,\n                'total': self.user.number_of_penalties()\n            },\n            subject=f'Du har f\u00e5tt en ny prikk',\n            plain_template='users/email/penalty.txt',\n            html_template='users/email/penalty.html',\n        )\n\n    def generate_push(self):\n        penalty = self.kwargs['penalty']\n\n        return self._delay_push(\n            template='users/push/penalty.txt', context={\n                'weight': penalty.weight,\n                'event': penalty.source_event.title,\n            }, instance=penalty\n        )\n", "path": "lego/apps/users/notifications.py"}], "after_files": [{"content": "from lego.apps.feed.activities import Activity\nfrom lego.apps.feed.feed_handlers.base_handler import BaseHandler\nfrom lego.apps.feed.feed_manager import feed_manager\nfrom lego.apps.feed.feeds.notification_feed import NotificationFeed\nfrom lego.apps.feed.registry import register_handler\nfrom lego.apps.feed.verbs import PenaltyVerb\nfrom lego.apps.users.models import Penalty\nfrom lego.apps.users.notifications import PenaltyNotification\n\n\nclass PenaltyHandler(BaseHandler):\n    model = Penalty\n    manager = feed_manager\n\n    def get_activity(self, penalty):\n        return Activity(\n            actor=penalty.source_event, verb=PenaltyVerb, object=penalty, target=penalty.user,\n            time=penalty.created_at, extra_context={\n                'reason': penalty.reason,\n                'weight': penalty.weight,\n            }\n        )\n\n    def handle_create(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n        # Send Notification\n        notification = PenaltyNotification(penalty.user, penalty=penalty)\n        notification.notify()\n\n    def handle_update(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.add_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n    def handle_delete(self, penalty):\n        activity = self.get_activity(penalty)\n        self.manager.remove_activity(activity, [penalty.user.pk], [NotificationFeed])\n\n\nregister_handler(PenaltyHandler)\n", "path": "lego/apps/feed/feed_handlers/penalty_handler.py"}, {"content": "from lego.apps.notifications.constants import PENALTY_CREATION\nfrom lego.apps.notifications.notification import Notification\n\n\nclass PenaltyNotification(Notification):\n\n    name = PENALTY_CREATION\n\n    def generate_mail(self):\n        penalty = self.kwargs['penalty']\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                'name': self.user.full_name,\n                'weight': penalty.weight,\n                'event': penalty.source_event.title,\n                'reason': penalty.reason,\n            },\n            subject=f'Du har f\u00e5tt en ny prikk',\n            plain_template='users/email/penalty.txt',\n            html_template='users/email/penalty.html',\n        )\n\n    def generate_push(self):\n        penalty = self.kwargs['penalty']\n\n        return self._delay_push(\n            template='users/push/penalty.txt', context={\n                'weight': penalty.weight,\n                'event': penalty.source_event.title,\n            }, instance=penalty\n        )\n", "path": "lego/apps/users/notifications.py"}]}