prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Ratings don't federate
  **Describe the bug**
  I do follow someone on bookwyrm.social from bookwyrm.social and wyrms.de. I have seen on b.s that they rated some books without reviewing them, but those ratings do not appear on w.d. All other posts federate properly (I think).
  
  **Expeceted behaviour**
  The rating should show up on connected instances and ideally also be used on those to calculate the average rating of the book.
  
  Here is one example that's not visible from w.d: https://bookwyrm.social/user/tastytea/reviewrating/21469
  
  </issue>
  <code>
  [start of bookwyrm/activitypub/note.py]
  1 """ note serializer and children thereof """
  2 from dataclasses import dataclass, field
  3 from typing import Dict, List
  4 from django.apps import apps
  5 
  6 from .base_activity import ActivityObject, Link
  7 from .image import Document
  8 
  9 
  10 @dataclass(init=False)
  11 class Tombstone(ActivityObject):
  12     """the placeholder for a deleted status"""
  13 
  14     type: str = "Tombstone"
  15 
  16     def to_model(self, *args, **kwargs):  # pylint: disable=unused-argument
  17         """this should never really get serialized, just searched for"""
  18         model = apps.get_model("bookwyrm.Status")
  19         return model.find_existing_by_remote_id(self.id)
  20 
  21 
  22 @dataclass(init=False)
  23 class Note(ActivityObject):
  24     """Note activity"""
  25 
  26     published: str
  27     attributedTo: str
  28     content: str = ""
  29     to: List[str] = field(default_factory=lambda: [])
  30     cc: List[str] = field(default_factory=lambda: [])
  31     replies: Dict = field(default_factory=lambda: {})
  32     inReplyTo: str = ""
  33     summary: str = ""
  34     tag: List[Link] = field(default_factory=lambda: [])
  35     attachment: List[Document] = field(default_factory=lambda: [])
  36     sensitive: bool = False
  37     type: str = "Note"
  38 
  39 
  40 @dataclass(init=False)
  41 class Article(Note):
  42     """what's an article except a note with more fields"""
  43 
  44     name: str
  45     type: str = "Article"
  46 
  47 
  48 @dataclass(init=False)
  49 class GeneratedNote(Note):
  50     """just a re-typed note"""
  51 
  52     type: str = "GeneratedNote"
  53 
  54 
  55 @dataclass(init=False)
  56 class Comment(Note):
  57     """like a note but with a book"""
  58 
  59     inReplyToBook: str
  60     type: str = "Comment"
  61 
  62 
  63 @dataclass(init=False)
  64 class Quotation(Comment):
  65     """a quote and commentary on a book"""
  66 
  67     quote: str
  68     type: str = "Quotation"
  69 
  70 
  71 @dataclass(init=False)
  72 class Review(Comment):
  73     """a full book review"""
  74 
  75     name: str = None
  76     rating: int = None
  77     type: str = "Review"
  78 
  79 
  80 @dataclass(init=False)
  81 class Rating(Comment):
  82     """just a star rating"""
  83 
  84     rating: int
  85     content: str = None
  86     type: str = "Rating"
  87
  [end of bookwyrm/activitypub/note.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/bookwyrm/activitypub/note.py b/bookwyrm/activitypub/note.py
  --- a/bookwyrm/activitypub/note.py
  +++ b/bookwyrm/activitypub/note.py
  @@ -83,4 +83,5 @@
   
       rating: int
       content: str = None
  +    name: str = None  # not used, but the model inherits from Review
       type: str = "Rating"
  
verification_info: {"golden_diff": "diff --git a/bookwyrm/activitypub/note.py b/bookwyrm/activitypub/note.py\n--- a/bookwyrm/activitypub/note.py\n+++ b/bookwyrm/activitypub/note.py\n@@ -83,4 +83,5 @@\n \n     rating: int\n     content: str = None\n+    name: str = None  # not used, but the model inherits from Review\n     type: str = \"Rating\"\n", "issue": "Ratings don't federate\n**Describe the bug**\r\nI do follow someone on bookwyrm.social from bookwyrm.social and wyrms.de. I have seen on b.s that they rated some books without reviewing them, but those ratings do not appear on w.d. All other posts federate properly (I think).\r\n\r\n**Expeceted behaviour**\r\nThe rating should show up on connected instances and ideally also be used on those to calculate the average rating of the book.\r\n\r\nHere is one example that's not visible from w.d: https://bookwyrm.social/user/tastytea/reviewrating/21469\n", "before_files": [{"content": "\"\"\" note serializer and children thereof \"\"\"\nfrom dataclasses import dataclass, field\nfrom typing import Dict, List\nfrom django.apps import apps\n\nfrom .base_activity import ActivityObject, Link\nfrom .image import Document\n\n\n@dataclass(init=False)\nclass Tombstone(ActivityObject):\n    \"\"\"the placeholder for a deleted status\"\"\"\n\n    type: str = \"Tombstone\"\n\n    def to_model(self, *args, **kwargs):  # pylint: disable=unused-argument\n        \"\"\"this should never really get serialized, just searched for\"\"\"\n        model = apps.get_model(\"bookwyrm.Status\")\n        return model.find_existing_by_remote_id(self.id)\n\n\n@dataclass(init=False)\nclass Note(ActivityObject):\n    \"\"\"Note activity\"\"\"\n\n    published: str\n    attributedTo: str\n    content: str = \"\"\n    to: List[str] = field(default_factory=lambda: [])\n    cc: List[str] = field(default_factory=lambda: [])\n    replies: Dict = field(default_factory=lambda: {})\n    inReplyTo: str = \"\"\n    summary: str = \"\"\n    tag: List[Link] = field(default_factory=lambda: [])\n    attachment: List[Document] = field(default_factory=lambda: [])\n    sensitive: bool = False\n    type: str = \"Note\"\n\n\n@dataclass(init=False)\nclass Article(Note):\n    \"\"\"what's an article except a note with more fields\"\"\"\n\n    name: str\n    type: str = \"Article\"\n\n\n@dataclass(init=False)\nclass GeneratedNote(Note):\n    \"\"\"just a re-typed note\"\"\"\n\n    type: str = \"GeneratedNote\"\n\n\n@dataclass(init=False)\nclass Comment(Note):\n    \"\"\"like a note but with a book\"\"\"\n\n    inReplyToBook: str\n    type: str = \"Comment\"\n\n\n@dataclass(init=False)\nclass Quotation(Comment):\n    \"\"\"a quote and commentary on a book\"\"\"\n\n    quote: str\n    type: str = \"Quotation\"\n\n\n@dataclass(init=False)\nclass Review(Comment):\n    \"\"\"a full book review\"\"\"\n\n    name: str = None\n    rating: int = None\n    type: str = \"Review\"\n\n\n@dataclass(init=False)\nclass Rating(Comment):\n    \"\"\"just a star rating\"\"\"\n\n    rating: int\n    content: str = None\n    type: str = \"Rating\"\n", "path": "bookwyrm/activitypub/note.py"}]}