prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  SubmissionSchema needs more nested fields
  I'm having trouble accessing a user's name from a SubmissionSchema dump. This is probably because we need more Nested Fields on the Schema in addition to just the nested challenge schema. 
  
  </issue>
  <code>
  [start of CTFd/schemas/submissions.py]
  1 from marshmallow import fields
  2 
  3 from CTFd.models import Submissions, ma
  4 from CTFd.schemas.challenges import ChallengeSchema
  5 from CTFd.utils import string_types
  6 
  7 
  8 class SubmissionSchema(ma.ModelSchema):
  9     challenge = fields.Nested(ChallengeSchema, only=["name", "category", "value"])
  10 
  11     class Meta:
  12         model = Submissions
  13         include_fk = True
  14         dump_only = ("id",)
  15 
  16     views = {
  17         "admin": [
  18             "provided",
  19             "ip",
  20             "challenge_id",
  21             "challenge",
  22             "user",
  23             "team",
  24             "date",
  25             "type",
  26             "id",
  27         ],
  28         "user": ["challenge_id", "challenge", "user", "team", "date", "type", "id"],
  29     }
  30 
  31     def __init__(self, view=None, *args, **kwargs):
  32         if view:
  33             if isinstance(view, string_types):
  34                 kwargs["only"] = self.views[view]
  35             elif isinstance(view, list):
  36                 kwargs["only"] = view
  37 
  38         super(SubmissionSchema, self).__init__(*args, **kwargs)
  39
  [end of CTFd/schemas/submissions.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/CTFd/schemas/submissions.py b/CTFd/schemas/submissions.py
  --- a/CTFd/schemas/submissions.py
  +++ b/CTFd/schemas/submissions.py
  @@ -2,11 +2,15 @@
   
   from CTFd.models import Submissions, ma
   from CTFd.schemas.challenges import ChallengeSchema
  +from CTFd.schemas.teams import TeamSchema
  +from CTFd.schemas.users import UserSchema
   from CTFd.utils import string_types
   
   
   class SubmissionSchema(ma.ModelSchema):
  -    challenge = fields.Nested(ChallengeSchema, only=["name", "category", "value"])
  +    challenge = fields.Nested(ChallengeSchema, only=["id", "name", "category", "value"])
  +    user = fields.Nested(UserSchema, only=["id", "name"])
  +    team = fields.Nested(TeamSchema, only=["id", "name"])
   
       class Meta:
           model = Submissions
  
verification_info: {"golden_diff": "diff --git a/CTFd/schemas/submissions.py b/CTFd/schemas/submissions.py\n--- a/CTFd/schemas/submissions.py\n+++ b/CTFd/schemas/submissions.py\n@@ -2,11 +2,15 @@\n \n from CTFd.models import Submissions, ma\n from CTFd.schemas.challenges import ChallengeSchema\n+from CTFd.schemas.teams import TeamSchema\n+from CTFd.schemas.users import UserSchema\n from CTFd.utils import string_types\n \n \n class SubmissionSchema(ma.ModelSchema):\n-    challenge = fields.Nested(ChallengeSchema, only=[\"name\", \"category\", \"value\"])\n+    challenge = fields.Nested(ChallengeSchema, only=[\"id\", \"name\", \"category\", \"value\"])\n+    user = fields.Nested(UserSchema, only=[\"id\", \"name\"])\n+    team = fields.Nested(TeamSchema, only=[\"id\", \"name\"])\n \n     class Meta:\n         model = Submissions\n", "issue": "SubmissionSchema needs more nested fields\nI'm having trouble accessing a user's name from a SubmissionSchema dump. This is probably because we need more Nested Fields on the Schema in addition to just the nested challenge schema. \n", "before_files": [{"content": "from marshmallow import fields\n\nfrom CTFd.models import Submissions, ma\nfrom CTFd.schemas.challenges import ChallengeSchema\nfrom CTFd.utils import string_types\n\n\nclass SubmissionSchema(ma.ModelSchema):\n    challenge = fields.Nested(ChallengeSchema, only=[\"name\", \"category\", \"value\"])\n\n    class Meta:\n        model = Submissions\n        include_fk = True\n        dump_only = (\"id\",)\n\n    views = {\n        \"admin\": [\n            \"provided\",\n            \"ip\",\n            \"challenge_id\",\n            \"challenge\",\n            \"user\",\n            \"team\",\n            \"date\",\n            \"type\",\n            \"id\",\n        ],\n        \"user\": [\"challenge_id\", \"challenge\", \"user\", \"team\", \"date\", \"type\", \"id\"],\n    }\n\n    def __init__(self, view=None, *args, **kwargs):\n        if view:\n            if isinstance(view, string_types):\n                kwargs[\"only\"] = self.views[view]\n            elif isinstance(view, list):\n                kwargs[\"only\"] = view\n\n        super(SubmissionSchema, self).__init__(*args, **kwargs)\n", "path": "CTFd/schemas/submissions.py"}]}