prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add review count to book search listing to concentrate reviews
  Often when I'm searching for a book to e.g. mark as having started reading, or to figure out if any other wyrms have reviewed it, I'll have more than one search result. 
  
  ![image](https://user-images.githubusercontent.com/3862362/196053166-f31dc917-15d7-411e-8249-97706cdb5869.png)
  _two results for wayfarer no 2_
  
  I typically don't really care so much about reviewing a given edition (I read a lot of non-scholarly ebooks). So instead of finding a particular edition, I want to find the one that has been reviewed by people I follow & whose judgement I trust. Similarly, I'd want to contribute _my_ review to that growing pile of context around a given book.
  
  To aid this, I suggest adding some light information markers to the search results. # of reviews would be one concrete suggestions, another would be to display which ones people I'm following have reviewed. Basically use whatever makes sense from a fast query perspective imo :)
  
  Thanks again for bookwyrm! It's a delightful space and I've found _so_ many books over the soon-to-be 2 years since I joined!! u rok
  
  </issue>
  <code>
  [start of bookwyrm/templatetags/book_display_tags.py]
  1 """ template filters """
  2 from django import template
  3 
  4 
  5 register = template.Library()
  6 
  7 
  8 @register.filter(name="book_description")
  9 def get_book_description(book):
  10     """use the work's text if the book doesn't have it"""
  11     if book.description:
  12         return book.description
  13     if book.parent_work:
  14         # this shoud always be true
  15         return book.parent_work.description
  16     return None
  17 
  18 
  19 @register.simple_tag(takes_context=False)
  20 def get_book_file_links(book):
  21     """links for a book"""
  22     return book.file_links.filter(domain__status="approved")
  23 
  24 
  25 @register.filter(name="author_edition")
  26 def get_author_edition(book, author):
  27     """default edition for a book on the author page"""
  28     return book.author_edition(author)
  29
  [end of bookwyrm/templatetags/book_display_tags.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/templatetags/book_display_tags.py b/bookwyrm/templatetags/book_display_tags.py
  --- a/bookwyrm/templatetags/book_display_tags.py
  +++ b/bookwyrm/templatetags/book_display_tags.py
  @@ -1,10 +1,17 @@
   """ template filters """
   from django import template
  +from bookwyrm import models
   
   
   register = template.Library()
   
   
  +@register.filter(name="review_count")
  +def get_review_count(book):
  +    """how many reviews?"""
  +    return models.Review.objects.filter(deleted=False, book=book).count()
  +
  +
   @register.filter(name="book_description")
   def get_book_description(book):
       """use the work's text if the book doesn't have it"""
  
verification_info: {"golden_diff": "diff --git a/bookwyrm/templatetags/book_display_tags.py b/bookwyrm/templatetags/book_display_tags.py\n--- a/bookwyrm/templatetags/book_display_tags.py\n+++ b/bookwyrm/templatetags/book_display_tags.py\n@@ -1,10 +1,17 @@\n \"\"\" template filters \"\"\"\n from django import template\n+from bookwyrm import models\n \n \n register = template.Library()\n \n \n+@register.filter(name=\"review_count\")\n+def get_review_count(book):\n+    \"\"\"how many reviews?\"\"\"\n+    return models.Review.objects.filter(deleted=False, book=book).count()\n+\n+\n @register.filter(name=\"book_description\")\n def get_book_description(book):\n     \"\"\"use the work's text if the book doesn't have it\"\"\"\n", "issue": "Add review count to book search listing to concentrate reviews\nOften when I'm searching for a book to e.g. mark as having started reading, or to figure out if any other wyrms have reviewed it, I'll have more than one search result. \r\n\r\n![image](https://user-images.githubusercontent.com/3862362/196053166-f31dc917-15d7-411e-8249-97706cdb5869.png)\r\n_two results for wayfarer no 2_\r\n\r\nI typically don't really care so much about reviewing a given edition (I read a lot of non-scholarly ebooks). So instead of finding a particular edition, I want to find the one that has been reviewed by people I follow & whose judgement I trust. Similarly, I'd want to contribute _my_ review to that growing pile of context around a given book.\r\n\r\nTo aid this, I suggest adding some light information markers to the search results. # of reviews would be one concrete suggestions, another would be to display which ones people I'm following have reviewed. Basically use whatever makes sense from a fast query perspective imo :)\r\n\r\nThanks again for bookwyrm! It's a delightful space and I've found _so_ many books over the soon-to-be 2 years since I joined!! u rok\n", "before_files": [{"content": "\"\"\" template filters \"\"\"\nfrom django import template\n\n\nregister = template.Library()\n\n\n@register.filter(name=\"book_description\")\ndef get_book_description(book):\n    \"\"\"use the work's text if the book doesn't have it\"\"\"\n    if book.description:\n        return book.description\n    if book.parent_work:\n        # this shoud always be true\n        return book.parent_work.description\n    return None\n\n\n@register.simple_tag(takes_context=False)\ndef get_book_file_links(book):\n    \"\"\"links for a book\"\"\"\n    return book.file_links.filter(domain__status=\"approved\")\n\n\n@register.filter(name=\"author_edition\")\ndef get_author_edition(book, author):\n    \"\"\"default edition for a book on the author page\"\"\"\n    return book.author_edition(author)\n", "path": "bookwyrm/templatetags/book_display_tags.py"}]}