prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Remove error about not picking category properly
  ## Current Behavior
  
  When user access labeling page without choosing the category via the category page he/she receives an error about not choosing the category properly. While this is necessary for preventing users accessing this page, it makes development more difficult. Every time when front-end loads, developer has to go back to category page.
  
  ## Expected Behavior
  
  There shouldn't be an error about not picking category properly. 
  
  ## Steps to Reproduce the Problem
  
    1. Go to labeling page `/labeling` without going through category page.
  
  ## Additional comment (optional)
  
  We should probably get category using `queryParams` like before and load current category on marker page.
  
  
  </issue>
  <code>
  [start of backend/medtagger/api/tasks/service_rest.py]
  1 """Module responsible for definition of Tasks service available via HTTP REST API."""
  2 from typing import Any
  3 
  4 from flask import request
  5 from flask_restplus import Resource
  6 
  7 from medtagger.api import api
  8 from medtagger.api.tasks import business, serializers
  9 from medtagger.api.security import login_required, role_required
  10 from medtagger.database.models import LabelTag
  11 
  12 tasks_ns = api.namespace('tasks', 'Methods related with tasks')
  13 
  14 
  15 @tasks_ns.route('')
  16 class Tasks(Resource):
  17     """Endpoint that manages tasks."""
  18 
  19     @staticmethod
  20     @login_required
  21     @tasks_ns.marshal_with(serializers.out__task)
  22     @tasks_ns.doc(security='token')
  23     @tasks_ns.doc(description='Return all available tasks.')
  24     @tasks_ns.doc(responses={200: 'Success'})
  25     def get() -> Any:
  26         """Return all available tasks."""
  27         return business.get_tasks()
  28 
  29     @staticmethod
  30     @login_required
  31     @role_required('admin')
  32     @tasks_ns.expect(serializers.in__task)
  33     @tasks_ns.marshal_with(serializers.out__task)
  34     @tasks_ns.doc(security='token')
  35     @tasks_ns.doc(description='Create new Task.')
  36     @tasks_ns.doc(responses={201: 'Success'})
  37     def post() -> Any:
  38         """Create new Task."""
  39         payload = request.json
  40 
  41         key = payload['key']
  42         name = payload['name']
  43         image_path = payload['image_path']
  44         datasets_keys = payload['datasets_keys']
  45         tags = [LabelTag(tag['key'], tag['name'], tag['tools']) for tag in payload['tags']]
  46 
  47         return business.create_task(key, name, image_path, datasets_keys, tags), 201
  48
  [end of backend/medtagger/api/tasks/service_rest.py]
  [start of backend/medtagger/api/tasks/business.py]
  1 """Module responsible for business logic in all Tasks endpoints."""
  2 from typing import List
  3 
  4 from medtagger.database.models import Task, LabelTag
  5 from medtagger.repositories import (
  6     tasks as TasksRepository,
  7 )
  8 
  9 
  10 def get_tasks() -> List[Task]:
  11     """Fetch all tasks.
  12 
  13     :return: list of tasks
  14     """
  15     return TasksRepository.get_all_tasks()
  16 
  17 
  18 def create_task(key: str, name: str, image_path: str, datasets_keys: List[str], tags: List[LabelTag]) -> Task:
  19     """Create new Task.
  20 
  21     :param key: unique key representing Task
  22     :param name: name which describes this Task
  23     :param image_path: path to the image which is located on the frontend
  24     :param datasets_keys: Keys of Datasets that Task takes Scans from
  25     :param tags: Label Tags that will be created and assigned to Task
  26     :return: Task object
  27     """
  28     return TasksRepository.add_task(key, name, image_path, datasets_keys, tags)
  29
  [end of backend/medtagger/api/tasks/business.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/backend/medtagger/api/tasks/business.py b/backend/medtagger/api/tasks/business.py
  --- a/backend/medtagger/api/tasks/business.py
  +++ b/backend/medtagger/api/tasks/business.py
  @@ -1,6 +1,9 @@
   """Module responsible for business logic in all Tasks endpoints."""
   from typing import List
   
  +from sqlalchemy.orm.exc import NoResultFound
  +
  +from medtagger.api.exceptions import NotFoundException
   from medtagger.database.models import Task, LabelTag
   from medtagger.repositories import (
       tasks as TasksRepository,
  @@ -15,6 +18,17 @@
       return TasksRepository.get_all_tasks()
   
   
  +def get_task_for_key(task_key: str) -> Task:
  +    """Fetch Task for given key.
  +
  +    :return: Task
  +    """
  +    try:
  +        return TasksRepository.get_task_by_key(task_key)
  +    except NoResultFound:
  +        raise NotFoundException('Did not found task for {} key!'.format(task_key))
  +
  +
   def create_task(key: str, name: str, image_path: str, datasets_keys: List[str], tags: List[LabelTag]) -> Task:
       """Create new Task.
   
  diff --git a/backend/medtagger/api/tasks/service_rest.py b/backend/medtagger/api/tasks/service_rest.py
  --- a/backend/medtagger/api/tasks/service_rest.py
  +++ b/backend/medtagger/api/tasks/service_rest.py
  @@ -43,5 +43,19 @@
           image_path = payload['image_path']
           datasets_keys = payload['datasets_keys']
           tags = [LabelTag(tag['key'], tag['name'], tag['tools']) for tag in payload['tags']]
  -
           return business.create_task(key, name, image_path, datasets_keys, tags), 201
  +
  +
  +@tasks_ns.route('/<string:task_key>')
  +class Task(Resource):
  +    """Endpoint that manages single task."""
  +
  +    @staticmethod
  +    @login_required
  +    @tasks_ns.marshal_with(serializers.out__task)
  +    @tasks_ns.doc(security='token')
  +    @tasks_ns.doc(description='Get task for given key.')
  +    @tasks_ns.doc(responses={200: 'Success', 404: 'Could not find task'})
  +    def get(task_key: str) -> Any:
  +        """Return task for given key."""
  +        return business.get_task_for_key(task_key)
  
verification_info: {"golden_diff": "diff --git a/backend/medtagger/api/tasks/business.py b/backend/medtagger/api/tasks/business.py\n--- a/backend/medtagger/api/tasks/business.py\n+++ b/backend/medtagger/api/tasks/business.py\n@@ -1,6 +1,9 @@\n \"\"\"Module responsible for business logic in all Tasks endpoints.\"\"\"\n from typing import List\n \n+from sqlalchemy.orm.exc import NoResultFound\n+\n+from medtagger.api.exceptions import NotFoundException\n from medtagger.database.models import Task, LabelTag\n from medtagger.repositories import (\n     tasks as TasksRepository,\n@@ -15,6 +18,17 @@\n     return TasksRepository.get_all_tasks()\n \n \n+def get_task_for_key(task_key: str) -> Task:\n+    \"\"\"Fetch Task for given key.\n+\n+    :return: Task\n+    \"\"\"\n+    try:\n+        return TasksRepository.get_task_by_key(task_key)\n+    except NoResultFound:\n+        raise NotFoundException('Did not found task for {} key!'.format(task_key))\n+\n+\n def create_task(key: str, name: str, image_path: str, datasets_keys: List[str], tags: List[LabelTag]) -> Task:\n     \"\"\"Create new Task.\n \ndiff --git a/backend/medtagger/api/tasks/service_rest.py b/backend/medtagger/api/tasks/service_rest.py\n--- a/backend/medtagger/api/tasks/service_rest.py\n+++ b/backend/medtagger/api/tasks/service_rest.py\n@@ -43,5 +43,19 @@\n         image_path = payload['image_path']\n         datasets_keys = payload['datasets_keys']\n         tags = [LabelTag(tag['key'], tag['name'], tag['tools']) for tag in payload['tags']]\n-\n         return business.create_task(key, name, image_path, datasets_keys, tags), 201\n+\n+\n+@tasks_ns.route('/<string:task_key>')\n+class Task(Resource):\n+    \"\"\"Endpoint that manages single task.\"\"\"\n+\n+    @staticmethod\n+    @login_required\n+    @tasks_ns.marshal_with(serializers.out__task)\n+    @tasks_ns.doc(security='token')\n+    @tasks_ns.doc(description='Get task for given key.')\n+    @tasks_ns.doc(responses={200: 'Success', 404: 'Could not find task'})\n+    def get(task_key: str) -> Any:\n+        \"\"\"Return task for given key.\"\"\"\n+        return business.get_task_for_key(task_key)\n", "issue": "Remove error about not picking category properly\n## Current Behavior\r\n\r\nWhen user access labeling page without choosing the category via the category page he/she receives an error about not choosing the category properly. While this is necessary for preventing users accessing this page, it makes development more difficult. Every time when front-end loads, developer has to go back to category page.\r\n\r\n## Expected Behavior\r\n\r\nThere shouldn't be an error about not picking category properly. \r\n\r\n## Steps to Reproduce the Problem\r\n\r\n  1. Go to labeling page `/labeling` without going through category page.\r\n\r\n## Additional comment (optional)\r\n\r\nWe should probably get category using `queryParams` like before and load current category on marker page.\r\n\n", "before_files": [{"content": "\"\"\"Module responsible for definition of Tasks service available via HTTP REST API.\"\"\"\nfrom typing import Any\n\nfrom flask import request\nfrom flask_restplus import Resource\n\nfrom medtagger.api import api\nfrom medtagger.api.tasks import business, serializers\nfrom medtagger.api.security import login_required, role_required\nfrom medtagger.database.models import LabelTag\n\ntasks_ns = api.namespace('tasks', 'Methods related with tasks')\n\n\n@tasks_ns.route('')\nclass Tasks(Resource):\n    \"\"\"Endpoint that manages tasks.\"\"\"\n\n    @staticmethod\n    @login_required\n    @tasks_ns.marshal_with(serializers.out__task)\n    @tasks_ns.doc(security='token')\n    @tasks_ns.doc(description='Return all available tasks.')\n    @tasks_ns.doc(responses={200: 'Success'})\n    def get() -> Any:\n        \"\"\"Return all available tasks.\"\"\"\n        return business.get_tasks()\n\n    @staticmethod\n    @login_required\n    @role_required('admin')\n    @tasks_ns.expect(serializers.in__task)\n    @tasks_ns.marshal_with(serializers.out__task)\n    @tasks_ns.doc(security='token')\n    @tasks_ns.doc(description='Create new Task.')\n    @tasks_ns.doc(responses={201: 'Success'})\n    def post() -> Any:\n        \"\"\"Create new Task.\"\"\"\n        payload = request.json\n\n        key = payload['key']\n        name = payload['name']\n        image_path = payload['image_path']\n        datasets_keys = payload['datasets_keys']\n        tags = [LabelTag(tag['key'], tag['name'], tag['tools']) for tag in payload['tags']]\n\n        return business.create_task(key, name, image_path, datasets_keys, tags), 201\n", "path": "backend/medtagger/api/tasks/service_rest.py"}, {"content": "\"\"\"Module responsible for business logic in all Tasks endpoints.\"\"\"\nfrom typing import List\n\nfrom medtagger.database.models import Task, LabelTag\nfrom medtagger.repositories import (\n    tasks as TasksRepository,\n)\n\n\ndef get_tasks() -> List[Task]:\n    \"\"\"Fetch all tasks.\n\n    :return: list of tasks\n    \"\"\"\n    return TasksRepository.get_all_tasks()\n\n\ndef create_task(key: str, name: str, image_path: str, datasets_keys: List[str], tags: List[LabelTag]) -> Task:\n    \"\"\"Create new Task.\n\n    :param key: unique key representing Task\n    :param name: name which describes this Task\n    :param image_path: path to the image which is located on the frontend\n    :param datasets_keys: Keys of Datasets that Task takes Scans from\n    :param tags: Label Tags that will be created and assigned to Task\n    :return: Task object\n    \"\"\"\n    return TasksRepository.add_task(key, name, image_path, datasets_keys, tags)\n", "path": "backend/medtagger/api/tasks/business.py"}]}