prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Show results framework for private projects
  ## Test plan
  
  GIVEN the 'My results' tab in MyRSR
  WHEN searching for a private project
  THEN the project should appear in the list
  
  WHEN the private project is opened in 'My results'
  THEN the user should have full access to the results framework, just like a regular public project
  ## Issue description
  
  Currently, we have disabled the results framework in MyRSR for private projects. However, it should be possible to enter results data for private projects as well.
  
  
  </issue>
  <code>
  [start of akvo/rest/views/typeahead.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 """Akvo RSR is covered by the GNU Affero General Public License.
  4 See more details in the license.txt file located at the root folder of the
  5 Akvo RSR module. For additional details on the GNU license please
  6 see < http://www.gnu.org/licenses/agpl.html >.
  7 """
  8 
  9 from akvo.rest.serializers import (TypeaheadCountrySerializer,
  10                                    TypeaheadOrganisationSerializer,
  11                                    TypeaheadProjectSerializer,
  12                                    TypeaheadProjectUpdateSerializer)
  13 from akvo.rsr.models import Country, Organisation, Project, ProjectUpdate
  14 
  15 from rest_framework.decorators import api_view
  16 from rest_framework.response import Response
  17 
  18 
  19 def rejig(queryset, serializer):
  20     """Rearrange & add queryset count to the response data."""
  21     return {
  22         'count': queryset.count(),
  23         'results': serializer.data
  24     }
  25 
  26 
  27 @api_view(['GET'])
  28 def typeahead_country(request):
  29     countries = Country.objects.all()
  30     return Response(
  31         rejig(countries, TypeaheadCountrySerializer(countries, many=True))
  32     )
  33 
  34 
  35 @api_view(['GET'])
  36 def typeahead_organisation(request):
  37     organisations = Organisation.objects.all()
  38     return Response(
  39         rejig(organisations, TypeaheadOrganisationSerializer(organisations,
  40                                                              many=True))
  41     )
  42 
  43 
  44 @api_view(['GET'])
  45 def typeahead_user_organisations(request):
  46     user = request.user
  47     is_admin = user.is_active and (user.is_superuser or user.is_admin)
  48     organisations = user.approved_organisations() if not is_admin else Organisation.objects.all()
  49     return Response(
  50         rejig(organisations, TypeaheadOrganisationSerializer(organisations,
  51                                                              many=True))
  52     )
  53 
  54 
  55 @api_view(['GET'])
  56 def typeahead_project(request):
  57     projects = Project.objects.all().exclude(title='')
  58     return Response(
  59         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
  60     )
  61 
  62 
  63 @api_view(['GET'])
  64 def typeahead_user_projects(request):
  65     user = request.user
  66     is_admin = user.is_active and (user.is_superuser or user.is_admin)
  67     if is_admin:
  68         projects = Project.objects.all()
  69     else:
  70         projects = user.approved_organisations().all_projects()
  71     projects = projects.exclude(title='')
  72     return Response(
  73         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
  74     )
  75 
  76 
  77 @api_view(['GET'])
  78 def typeahead_impact_projects(request):
  79     user = request.user
  80     projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()
  81     projects = projects.published().filter(is_impact_project=True, is_public=True).order_by('title')
  82 
  83     return Response(
  84         rejig(projects, TypeaheadProjectSerializer(projects, many=True))
  85     )
  86 
  87 
  88 @api_view(['GET'])
  89 def typeahead_projectupdate(request):
  90     updates = ProjectUpdate.objects.all()
  91     return Response(
  92         rejig(updates, TypeaheadProjectUpdateSerializer(updates, many=True))
  93     )
  94
  [end of akvo/rest/views/typeahead.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/akvo/rest/views/typeahead.py b/akvo/rest/views/typeahead.py
  --- a/akvo/rest/views/typeahead.py
  +++ b/akvo/rest/views/typeahead.py
  @@ -78,7 +78,7 @@
   def typeahead_impact_projects(request):
       user = request.user
       projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()
  -    projects = projects.published().filter(is_impact_project=True, is_public=True).order_by('title')
  +    projects = projects.published().filter(is_impact_project=True).order_by('title')
   
       return Response(
           rejig(projects, TypeaheadProjectSerializer(projects, many=True))
  
verification_info: {"golden_diff": "diff --git a/akvo/rest/views/typeahead.py b/akvo/rest/views/typeahead.py\n--- a/akvo/rest/views/typeahead.py\n+++ b/akvo/rest/views/typeahead.py\n@@ -78,7 +78,7 @@\n def typeahead_impact_projects(request):\n     user = request.user\n     projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()\n-    projects = projects.published().filter(is_impact_project=True, is_public=True).order_by('title')\n+    projects = projects.published().filter(is_impact_project=True).order_by('title')\n \n     return Response(\n         rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n", "issue": "Show results framework for private projects\n## Test plan\n\nGIVEN the 'My results' tab in MyRSR\nWHEN searching for a private project\nTHEN the project should appear in the list\n\nWHEN the private project is opened in 'My results'\nTHEN the user should have full access to the results framework, just like a regular public project\n## Issue description\n\nCurrently, we have disabled the results framework in MyRSR for private projects. However, it should be possible to enter results data for private projects as well.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n\"\"\"Akvo RSR is covered by the GNU Affero General Public License.\nSee more details in the license.txt file located at the root folder of the\nAkvo RSR module. For additional details on the GNU license please\nsee < http://www.gnu.org/licenses/agpl.html >.\n\"\"\"\n\nfrom akvo.rest.serializers import (TypeaheadCountrySerializer,\n                                   TypeaheadOrganisationSerializer,\n                                   TypeaheadProjectSerializer,\n                                   TypeaheadProjectUpdateSerializer)\nfrom akvo.rsr.models import Country, Organisation, Project, ProjectUpdate\n\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\n\ndef rejig(queryset, serializer):\n    \"\"\"Rearrange & add queryset count to the response data.\"\"\"\n    return {\n        'count': queryset.count(),\n        'results': serializer.data\n    }\n\n\n@api_view(['GET'])\ndef typeahead_country(request):\n    countries = Country.objects.all()\n    return Response(\n        rejig(countries, TypeaheadCountrySerializer(countries, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_organisation(request):\n    organisations = Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_organisations(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    organisations = user.approved_organisations() if not is_admin else Organisation.objects.all()\n    return Response(\n        rejig(organisations, TypeaheadOrganisationSerializer(organisations,\n                                                             many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_project(request):\n    projects = Project.objects.all().exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_user_projects(request):\n    user = request.user\n    is_admin = user.is_active and (user.is_superuser or user.is_admin)\n    if is_admin:\n        projects = Project.objects.all()\n    else:\n        projects = user.approved_organisations().all_projects()\n    projects = projects.exclude(title='')\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_impact_projects(request):\n    user = request.user\n    projects = Project.objects.all() if user.is_admin or user.is_superuser else user.my_projects()\n    projects = projects.published().filter(is_impact_project=True, is_public=True).order_by('title')\n\n    return Response(\n        rejig(projects, TypeaheadProjectSerializer(projects, many=True))\n    )\n\n\n@api_view(['GET'])\ndef typeahead_projectupdate(request):\n    updates = ProjectUpdate.objects.all()\n    return Response(\n        rejig(updates, TypeaheadProjectUpdateSerializer(updates, many=True))\n    )\n", "path": "akvo/rest/views/typeahead.py"}]}