prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Minor bug in export orders as CSV task
  **Describe the bug**
  Minor bug in exporting orders as CSV. Trying to decode string which throws a type error:
  ```python
                        if order.user and order.user.first_name else '',
                        str(order.user.last_name, 'utf-8')
  ```
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. Start export orders as csv task 
  2. Make sure user is linked for that particular order
  3. See the error
  
  **Expected behavior**
  It should work properly
  
  **Stacktrace**
  ```sh
    File "/home/mayank/OpenSource/open-event-server/app/api/helpers/tasks.py", line 238, in export_order_csv_task
      content = export_orders_csv(orders)
    File "/home/mayank/OpenSource/open-event-server/app/api/helpers/csv_jobs_util.py", line 13, in export_orders_csv
      if order.user and order.user.first_name else '',
  TypeError: decoding str is not supported
  ```
  **Additional details (please complete the following information):**
   - OS: Ubuntu 18.04
   - Python Version 3.6
   - `HEAD` Commit hash [e.g. `4629c62`]
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/api/helpers/csv_jobs_util.py`
  Content:
  ```
  1 def export_orders_csv(orders):
  2     headers = ['Order#', 'Order Date', 'Status', 'Payment Type', 'Total Amount', 'Quantity',
  3                'Discount Code', 'First Name', 'Last Name', 'Email']
  4 
  5     rows = [headers]
  6     for order in orders:
  7         if order.status != "deleted":
  8             column = [str(order.get_invoice_number()), str(order.created_at) if order.created_at else '',
  9                       str(order.status) if order.status else '', str(order.paid_via) if order.paid_via else '',
  10                       str(order.amount) if order.amount else '', str(order.get_tickets_count()),
  11                       str(order.discount_code.code) if order.discount_code else '',
  12                       str(order.user.first_name, 'utf-8')
  13                       if order.user and order.user.first_name else '',
  14                       str(order.user.last_name, 'utf-8')
  15                       if order.user and order.user.last_name else '',
  16                       str(order.user._email, 'utf-8') if order.user and order.user._email else '']
  17             rows.append(column)
  18 
  19     return rows
  20
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/app/api/helpers/csv_jobs_util.py b/app/api/helpers/csv_jobs_util.py
  --- a/app/api/helpers/csv_jobs_util.py
  +++ b/app/api/helpers/csv_jobs_util.py
  @@ -9,11 +9,11 @@
                         str(order.status) if order.status else '', str(order.paid_via) if order.paid_via else '',
                         str(order.amount) if order.amount else '', str(order.get_tickets_count()),
                         str(order.discount_code.code) if order.discount_code else '',
  -                      str(order.user.first_name, 'utf-8')
  +                      str(order.user.first_name)
                         if order.user and order.user.first_name else '',
  -                      str(order.user.last_name, 'utf-8')
  +                      str(order.user.last_name)
                         if order.user and order.user.last_name else '',
  -                      str(order.user._email, 'utf-8') if order.user and order.user._email else '']
  +                      str(order.user.email) if order.user and order.user.email else '']
               rows.append(column)
   
       return rows
  
verification_info: {"golden_diff": "diff --git a/app/api/helpers/csv_jobs_util.py b/app/api/helpers/csv_jobs_util.py\n--- a/app/api/helpers/csv_jobs_util.py\n+++ b/app/api/helpers/csv_jobs_util.py\n@@ -9,11 +9,11 @@\n                       str(order.status) if order.status else '', str(order.paid_via) if order.paid_via else '',\n                       str(order.amount) if order.amount else '', str(order.get_tickets_count()),\n                       str(order.discount_code.code) if order.discount_code else '',\n-                      str(order.user.first_name, 'utf-8')\n+                      str(order.user.first_name)\n                       if order.user and order.user.first_name else '',\n-                      str(order.user.last_name, 'utf-8')\n+                      str(order.user.last_name)\n                       if order.user and order.user.last_name else '',\n-                      str(order.user._email, 'utf-8') if order.user and order.user._email else '']\n+                      str(order.user.email) if order.user and order.user.email else '']\n             rows.append(column)\n \n     return rows\n", "issue": "Minor bug in export orders as CSV task\n**Describe the bug**\r\nMinor bug in exporting orders as CSV. Trying to decode string which throws a type error:\r\n```python\r\n                      if order.user and order.user.first_name else '',\r\n                      str(order.user.last_name, 'utf-8')\r\n```\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Start export orders as csv task \r\n2. Make sure user is linked for that particular order\r\n3. See the error\r\n\r\n**Expected behavior**\r\nIt should work properly\r\n\r\n**Stacktrace**\r\n```sh\r\n  File \"/home/mayank/OpenSource/open-event-server/app/api/helpers/tasks.py\", line 238, in export_order_csv_task\r\n    content = export_orders_csv(orders)\r\n  File \"/home/mayank/OpenSource/open-event-server/app/api/helpers/csv_jobs_util.py\", line 13, in export_orders_csv\r\n    if order.user and order.user.first_name else '',\r\nTypeError: decoding str is not supported\r\n```\r\n**Additional details (please complete the following information):**\r\n - OS: Ubuntu 18.04\r\n - Python Version 3.6\r\n - `HEAD` Commit hash [e.g. `4629c62`]\n", "before_files": [{"content": "def export_orders_csv(orders):\n    headers = ['Order#', 'Order Date', 'Status', 'Payment Type', 'Total Amount', 'Quantity',\n               'Discount Code', 'First Name', 'Last Name', 'Email']\n\n    rows = [headers]\n    for order in orders:\n        if order.status != \"deleted\":\n            column = [str(order.get_invoice_number()), str(order.created_at) if order.created_at else '',\n                      str(order.status) if order.status else '', str(order.paid_via) if order.paid_via else '',\n                      str(order.amount) if order.amount else '', str(order.get_tickets_count()),\n                      str(order.discount_code.code) if order.discount_code else '',\n                      str(order.user.first_name, 'utf-8')\n                      if order.user and order.user.first_name else '',\n                      str(order.user.last_name, 'utf-8')\n                      if order.user and order.user.last_name else '',\n                      str(order.user._email, 'utf-8') if order.user and order.user._email else '']\n            rows.append(column)\n\n    return rows\n", "path": "app/api/helpers/csv_jobs_util.py"}], "after_files": [{"content": "def export_orders_csv(orders):\n    headers = ['Order#', 'Order Date', 'Status', 'Payment Type', 'Total Amount', 'Quantity',\n               'Discount Code', 'First Name', 'Last Name', 'Email']\n\n    rows = [headers]\n    for order in orders:\n        if order.status != \"deleted\":\n            column = [str(order.get_invoice_number()), str(order.created_at) if order.created_at else '',\n                      str(order.status) if order.status else '', str(order.paid_via) if order.paid_via else '',\n                      str(order.amount) if order.amount else '', str(order.get_tickets_count()),\n                      str(order.discount_code.code) if order.discount_code else '',\n                      str(order.user.first_name)\n                      if order.user and order.user.first_name else '',\n                      str(order.user.last_name)\n                      if order.user and order.user.last_name else '',\n                      str(order.user.email) if order.user and order.user.email else '']\n            rows.append(column)\n\n    return rows\n", "path": "app/api/helpers/csv_jobs_util.py"}]}