prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  AttributeError: 'Event' object has no attribute 'number_regs'
  Sentry Issue: [CONCREXIT-HC](https://sentry.io/organizations/thalia/issues/3639420824/?referrer=github_integration)
  
  ```
  AttributeError: 'Event' object has no attribute 'number_regs'
  (11 additional frame(s) were not displayed)
  ...
    File "rest_framework/serializers.py", line 253, in data
      self._data = self.to_representation(self.instance)
    File "rest_framework/serializers.py", line 522, in to_representation
      ret[field.field_name] = field.to_representation(attribute)
    File "rest_framework/serializers.py", line 522, in to_representation
      ret[field.field_name] = field.to_representation(attribute)
    File "rest_framework/fields.py", line 1838, in to_representation
      return method(value)
    File "events/api/v2/serializers/event.py", line 86, in _num_participants
      participant_count = instance.number_regs
  ```
  
  </issue>
  <code>
  [start of website/events/api/v2/serializers/event.py]
  1 from rest_framework import serializers
  2 
  3 from activemembers.api.v2.serializers.member_group import MemberGroupSerializer
  4 from announcements.api.v2.serializers import SlideSerializer
  5 from documents.api.v2.serializers.document import DocumentSerializer
  6 from events import services
  7 from events.api.v2.serializers.event_registration import EventRegistrationSerializer
  8 from events.models import Event, EventRegistration
  9 from payments.api.v2.serializers.payment_amount import PaymentAmountSerializer
  10 from thaliawebsite.api.v2.serializers import CleanedHTMLSerializer
  11 from thaliawebsite.api.v2.serializers.cleaned_model_serializer import (
  12     CleanedModelSerializer,
  13 )
  14 from utils.snippets import create_google_maps_url
  15 
  16 
  17 class EventSerializer(CleanedModelSerializer):
  18     """Serializer for events."""
  19 
  20     class Meta:
  21         model = Event
  22         fields = (
  23             "pk",
  24             "title",
  25             "description",
  26             "caption",
  27             "start",
  28             "end",
  29             "category",
  30             "registration_start",
  31             "registration_end",
  32             "cancel_deadline",
  33             "optional_registrations",
  34             "location",
  35             "price",
  36             "fine",
  37             "num_participants",
  38             "max_participants",
  39             "no_registration_message",
  40             "cancel_too_late_message",
  41             "has_fields",
  42             "food_event",
  43             "maps_url",
  44             "user_permissions",
  45             "user_registration",
  46             "organisers",
  47             "slide",
  48             "documents",
  49         )
  50 
  51     description = CleanedHTMLSerializer()
  52     organisers = MemberGroupSerializer(many=True)
  53     user_registration = serializers.SerializerMethodField("_user_registration")
  54     num_participants = serializers.SerializerMethodField("_num_participants")
  55     maps_url = serializers.SerializerMethodField("_maps_url")
  56     price = PaymentAmountSerializer()
  57     fine = PaymentAmountSerializer()
  58     slide = SlideSerializer()
  59     documents = DocumentSerializer(many=True)
  60     user_permissions = serializers.SerializerMethodField("_user_permissions")
  61 
  62     def _user_registration(self, instance):
  63         try:
  64             if self.context["request"].member:
  65                 reg = instance.eventregistration_set.get(
  66                     member=self.context["request"].member
  67                 )
  68                 return EventRegistrationSerializer(
  69                     reg,
  70                     context=self.context,
  71                     fields=(
  72                         "pk",
  73                         "present",
  74                         "queue_position",
  75                         "is_cancelled",
  76                         "is_late_cancellation",
  77                         "date",
  78                         "payment",
  79                     ),
  80                 ).data
  81         except EventRegistration.DoesNotExist:
  82             pass
  83         return None
  84 
  85     def _num_participants(self, instance):
  86         participant_count = instance.number_regs
  87         if instance.max_participants and participant_count > instance.max_participants:
  88             return instance.max_participants
  89         return participant_count
  90 
  91     def _user_permissions(self, instance):
  92         member = self.context["request"].member
  93         return services.event_permissions(member, instance)
  94 
  95     def _maps_url(self, instance):
  96         return create_google_maps_url(instance.map_location, zoom=13, size="450x250")
  97
  [end of website/events/api/v2/serializers/event.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/website/events/api/v2/serializers/event.py b/website/events/api/v2/serializers/event.py
  --- a/website/events/api/v2/serializers/event.py
  +++ b/website/events/api/v2/serializers/event.py
  @@ -83,10 +83,7 @@
           return None
   
       def _num_participants(self, instance):
  -        participant_count = instance.number_regs
  -        if instance.max_participants and participant_count > instance.max_participants:
  -            return instance.max_participants
  -        return participant_count
  +        return instance.participants.count()
   
       def _user_permissions(self, instance):
           member = self.context["request"].member
  
verification_info: {"golden_diff": "diff --git a/website/events/api/v2/serializers/event.py b/website/events/api/v2/serializers/event.py\n--- a/website/events/api/v2/serializers/event.py\n+++ b/website/events/api/v2/serializers/event.py\n@@ -83,10 +83,7 @@\n         return None\n \n     def _num_participants(self, instance):\n-        participant_count = instance.number_regs\n-        if instance.max_participants and participant_count > instance.max_participants:\n-            return instance.max_participants\n-        return participant_count\n+        return instance.participants.count()\n \n     def _user_permissions(self, instance):\n         member = self.context[\"request\"].member\n", "issue": "AttributeError: 'Event' object has no attribute 'number_regs'\nSentry Issue: [CONCREXIT-HC](https://sentry.io/organizations/thalia/issues/3639420824/?referrer=github_integration)\n\n```\nAttributeError: 'Event' object has no attribute 'number_regs'\n(11 additional frame(s) were not displayed)\n...\n  File \"rest_framework/serializers.py\", line 253, in data\n    self._data = self.to_representation(self.instance)\n  File \"rest_framework/serializers.py\", line 522, in to_representation\n    ret[field.field_name] = field.to_representation(attribute)\n  File \"rest_framework/serializers.py\", line 522, in to_representation\n    ret[field.field_name] = field.to_representation(attribute)\n  File \"rest_framework/fields.py\", line 1838, in to_representation\n    return method(value)\n  File \"events/api/v2/serializers/event.py\", line 86, in _num_participants\n    participant_count = instance.number_regs\n```\n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom activemembers.api.v2.serializers.member_group import MemberGroupSerializer\nfrom announcements.api.v2.serializers import SlideSerializer\nfrom documents.api.v2.serializers.document import DocumentSerializer\nfrom events import services\nfrom events.api.v2.serializers.event_registration import EventRegistrationSerializer\nfrom events.models import Event, EventRegistration\nfrom payments.api.v2.serializers.payment_amount import PaymentAmountSerializer\nfrom thaliawebsite.api.v2.serializers import CleanedHTMLSerializer\nfrom thaliawebsite.api.v2.serializers.cleaned_model_serializer import (\n    CleanedModelSerializer,\n)\nfrom utils.snippets import create_google_maps_url\n\n\nclass EventSerializer(CleanedModelSerializer):\n    \"\"\"Serializer for events.\"\"\"\n\n    class Meta:\n        model = Event\n        fields = (\n            \"pk\",\n            \"title\",\n            \"description\",\n            \"caption\",\n            \"start\",\n            \"end\",\n            \"category\",\n            \"registration_start\",\n            \"registration_end\",\n            \"cancel_deadline\",\n            \"optional_registrations\",\n            \"location\",\n            \"price\",\n            \"fine\",\n            \"num_participants\",\n            \"max_participants\",\n            \"no_registration_message\",\n            \"cancel_too_late_message\",\n            \"has_fields\",\n            \"food_event\",\n            \"maps_url\",\n            \"user_permissions\",\n            \"user_registration\",\n            \"organisers\",\n            \"slide\",\n            \"documents\",\n        )\n\n    description = CleanedHTMLSerializer()\n    organisers = MemberGroupSerializer(many=True)\n    user_registration = serializers.SerializerMethodField(\"_user_registration\")\n    num_participants = serializers.SerializerMethodField(\"_num_participants\")\n    maps_url = serializers.SerializerMethodField(\"_maps_url\")\n    price = PaymentAmountSerializer()\n    fine = PaymentAmountSerializer()\n    slide = SlideSerializer()\n    documents = DocumentSerializer(many=True)\n    user_permissions = serializers.SerializerMethodField(\"_user_permissions\")\n\n    def _user_registration(self, instance):\n        try:\n            if self.context[\"request\"].member:\n                reg = instance.eventregistration_set.get(\n                    member=self.context[\"request\"].member\n                )\n                return EventRegistrationSerializer(\n                    reg,\n                    context=self.context,\n                    fields=(\n                        \"pk\",\n                        \"present\",\n                        \"queue_position\",\n                        \"is_cancelled\",\n                        \"is_late_cancellation\",\n                        \"date\",\n                        \"payment\",\n                    ),\n                ).data\n        except EventRegistration.DoesNotExist:\n            pass\n        return None\n\n    def _num_participants(self, instance):\n        participant_count = instance.number_regs\n        if instance.max_participants and participant_count > instance.max_participants:\n            return instance.max_participants\n        return participant_count\n\n    def _user_permissions(self, instance):\n        member = self.context[\"request\"].member\n        return services.event_permissions(member, instance)\n\n    def _maps_url(self, instance):\n        return create_google_maps_url(instance.map_location, zoom=13, size=\"450x250\")\n", "path": "website/events/api/v2/serializers/event.py"}]}