prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add fields in ChallengePhaseSerializer
  Please add fields `max_submissions_per_day` and `max_submissions` in the `Challenge Phase Serializer`. It is needed for the issue #704 .
  
  </issue>
  <code>
  [start of apps/challenges/serializers.py]
  1 from rest_framework import serializers
  2 
  3 from hosts.serializers import ChallengeHostTeamSerializer
  4 
  5 from .models import (
  6                      Challenge,
  7                      ChallengePhase,
  8                      ChallengePhaseSplit,
  9                      DatasetSplit,)
  10 
  11 
  12 class ChallengeSerializer(serializers.ModelSerializer):
  13 
  14     is_active = serializers.ReadOnlyField()
  15 
  16     def __init__(self, *args, **kwargs):
  17         super(ChallengeSerializer, self).__init__(*args, **kwargs)
  18         context = kwargs.get('context')
  19         if context and context.get('request').method != 'GET':
  20             challenge_host_team = context.get('challenge_host_team')
  21             kwargs['data']['creator'] = challenge_host_team.pk
  22         else:
  23             self.fields['creator'] = ChallengeHostTeamSerializer()
  24 
  25     class Meta:
  26         model = Challenge
  27         fields = ('id', 'title', 'description', 'terms_and_conditions',
  28                   'submission_guidelines', 'evaluation_details',
  29                   'image', 'start_date', 'end_date', 'creator',
  30                   'published', 'enable_forum', 'anonymous_leaderboard', 'is_active',)
  31 
  32 
  33 class ChallengePhaseSerializer(serializers.ModelSerializer):
  34 
  35     is_active = serializers.ReadOnlyField()
  36 
  37     def __init__(self, *args, **kwargs):
  38         super(ChallengePhaseSerializer, self).__init__(*args, **kwargs)
  39         context = kwargs.get('context')
  40         if context:
  41             challenge = context.get('challenge')
  42             kwargs['data']['challenge'] = challenge.pk
  43 
  44     class Meta:
  45         model = ChallengePhase
  46         fields = ('id', 'name', 'description', 'leaderboard_public', 'start_date',
  47                   'end_date', 'challenge', 'is_public', 'is_active', 'codename')
  48 
  49 
  50 class DatasetSplitSerializer(serializers.ModelSerializer):
  51 
  52     class Meta:
  53         model = DatasetSplit
  54         fields = '__all__'
  55 
  56 
  57 class ChallengePhaseSplitSerializer(serializers.ModelSerializer):
  58     """Serialize the ChallengePhaseSplits Model"""
  59 
  60     dataset_split_name = serializers.SerializerMethodField()
  61     challenge_phase_name = serializers.SerializerMethodField()
  62 
  63     class Meta:
  64         model = ChallengePhaseSplit
  65         fields = '__all__'
  66         fields = ('id', 'dataset_split', 'challenge_phase', 'challenge_phase_name', 'dataset_split_name', 'visibility')
  67 
  68     def get_dataset_split_name(self, obj):
  69         return obj.dataset_split.name
  70 
  71     def get_challenge_phase_name(self, obj):
  72         return obj.challenge_phase.name
  73
  [end of apps/challenges/serializers.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/apps/challenges/serializers.py b/apps/challenges/serializers.py
  --- a/apps/challenges/serializers.py
  +++ b/apps/challenges/serializers.py
  @@ -44,7 +44,8 @@
       class Meta:
           model = ChallengePhase
           fields = ('id', 'name', 'description', 'leaderboard_public', 'start_date',
  -                  'end_date', 'challenge', 'is_public', 'is_active', 'codename')
  +                  'end_date', 'challenge', 'max_submissions_per_day', 'max_submissions',
  +                  'is_public', 'is_active', 'codename')
   
   
   class DatasetSplitSerializer(serializers.ModelSerializer):
  
verification_info: {"golden_diff": "diff --git a/apps/challenges/serializers.py b/apps/challenges/serializers.py\n--- a/apps/challenges/serializers.py\n+++ b/apps/challenges/serializers.py\n@@ -44,7 +44,8 @@\n     class Meta:\n         model = ChallengePhase\n         fields = ('id', 'name', 'description', 'leaderboard_public', 'start_date',\n-                  'end_date', 'challenge', 'is_public', 'is_active', 'codename')\n+                  'end_date', 'challenge', 'max_submissions_per_day', 'max_submissions',\n+                  'is_public', 'is_active', 'codename')\n \n \n class DatasetSplitSerializer(serializers.ModelSerializer):\n", "issue": "Add fields in ChallengePhaseSerializer\nPlease add fields `max_submissions_per_day` and `max_submissions` in the `Challenge Phase Serializer`. It is needed for the issue #704 .\n", "before_files": [{"content": "from rest_framework import serializers\n\nfrom hosts.serializers import ChallengeHostTeamSerializer\n\nfrom .models import (\n                     Challenge,\n                     ChallengePhase,\n                     ChallengePhaseSplit,\n                     DatasetSplit,)\n\n\nclass ChallengeSerializer(serializers.ModelSerializer):\n\n    is_active = serializers.ReadOnlyField()\n\n    def __init__(self, *args, **kwargs):\n        super(ChallengeSerializer, self).__init__(*args, **kwargs)\n        context = kwargs.get('context')\n        if context and context.get('request').method != 'GET':\n            challenge_host_team = context.get('challenge_host_team')\n            kwargs['data']['creator'] = challenge_host_team.pk\n        else:\n            self.fields['creator'] = ChallengeHostTeamSerializer()\n\n    class Meta:\n        model = Challenge\n        fields = ('id', 'title', 'description', 'terms_and_conditions',\n                  'submission_guidelines', 'evaluation_details',\n                  'image', 'start_date', 'end_date', 'creator',\n                  'published', 'enable_forum', 'anonymous_leaderboard', 'is_active',)\n\n\nclass ChallengePhaseSerializer(serializers.ModelSerializer):\n\n    is_active = serializers.ReadOnlyField()\n\n    def __init__(self, *args, **kwargs):\n        super(ChallengePhaseSerializer, self).__init__(*args, **kwargs)\n        context = kwargs.get('context')\n        if context:\n            challenge = context.get('challenge')\n            kwargs['data']['challenge'] = challenge.pk\n\n    class Meta:\n        model = ChallengePhase\n        fields = ('id', 'name', 'description', 'leaderboard_public', 'start_date',\n                  'end_date', 'challenge', 'is_public', 'is_active', 'codename')\n\n\nclass DatasetSplitSerializer(serializers.ModelSerializer):\n\n    class Meta:\n        model = DatasetSplit\n        fields = '__all__'\n\n\nclass ChallengePhaseSplitSerializer(serializers.ModelSerializer):\n    \"\"\"Serialize the ChallengePhaseSplits Model\"\"\"\n\n    dataset_split_name = serializers.SerializerMethodField()\n    challenge_phase_name = serializers.SerializerMethodField()\n\n    class Meta:\n        model = ChallengePhaseSplit\n        fields = '__all__'\n        fields = ('id', 'dataset_split', 'challenge_phase', 'challenge_phase_name', 'dataset_split_name', 'visibility')\n\n    def get_dataset_split_name(self, obj):\n        return obj.dataset_split.name\n\n    def get_challenge_phase_name(self, obj):\n        return obj.challenge_phase.name\n", "path": "apps/challenges/serializers.py"}]}