We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Program PDF report returns an XLS report
# What were you doing?

Follow the steps in test "Download PDF Program overview".

# What should've happened?

A PDF report should've been received in the email, but an XLS report was delivered.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `akvo/rsr/views/py_reports/email_report.py`
Content:
```
1 import logging
2 
3 from datetime import timedelta
4 from django.db.models import Q
5 from django.utils.timezone import now
6 from akvo.rsr.models import EmailReportJob
7 
8 from . import (
9     program_overview_pdf_report,
10     program_overview_excel_report,
11     program_period_labels_overview_pdf_report,
12     results_indicators_with_map_pdf_reports,
13     nuffic_country_level_map_report,
14 )
15 
16 TIMEOUT = timedelta(minutes=30)
17 MAX_ATTEMPTS = 3
18 HANDLER = {
19     program_overview_pdf_report.REPORT_NAME: program_overview_excel_report.handle_email_report,
20     program_overview_excel_report.REPORT_NAME: program_overview_excel_report.handle_email_report,
21     program_period_labels_overview_pdf_report.REPORT_NAME: program_period_labels_overview_pdf_report.handle_email_report,
22     results_indicators_with_map_pdf_reports.ORG_PROJECTS_REPORT_NAME: results_indicators_with_map_pdf_reports.handle_org_projects_email_report,
23     nuffic_country_level_map_report.REPORT_NAME: nuffic_country_level_map_report.handle_email_report,
24 }
25 
26 logger = logging.getLogger(__name__)
27 
28 
29 def run_job():
30     pending_jobs = _get_pending_jobs()
31     if not pending_jobs.exists():
32         return
33     job = pending_jobs.first()
34     job.mark_started()
35     try:
36         handler = HANDLER.get(job.report, None)
37         if handler:
38             handler(job.payload, job.recipient)
39         job.mark_finished()
40     except Exception:
41         logger.exception(f'Failed to genereate report {job.report} for {job.recipient}')
42 
43 
44 def _get_pending_jobs():
45     started_timeout = now() - TIMEOUT
46     return EmailReportJob.objects\
47         .order_by('created_at')\
48         .filter(finished_at__isnull=True)\
49         .exclude(Q(attempts__gte=MAX_ATTEMPTS) | Q(started_at__gte=started_timeout))
50
```
--- 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()

```

diff --git a/akvo/rsr/views/py_reports/email_report.py b/akvo/rsr/views/py_reports/email_report.py
--- a/akvo/rsr/views/py_reports/email_report.py
+++ b/akvo/rsr/views/py_reports/email_report.py
@@ -16,7 +16,7 @@
 TIMEOUT = timedelta(minutes=30)
 MAX_ATTEMPTS = 3
 HANDLER = {
-    program_overview_pdf_report.REPORT_NAME: program_overview_excel_report.handle_email_report,
+    program_overview_pdf_report.REPORT_NAME: program_overview_pdf_report.handle_email_report,
     program_overview_excel_report.REPORT_NAME: program_overview_excel_report.handle_email_report,
     program_period_labels_overview_pdf_report.REPORT_NAME: program_period_labels_overview_pdf_report.handle_email_report,
     results_indicators_with_map_pdf_reports.ORG_PROJECTS_REPORT_NAME: results_indicators_with_map_pdf_reports.handle_org_projects_email_report,
@@ -35,6 +35,7 @@
     try:
         handler = HANDLER.get(job.report, None)
         if handler:
+            logger.info("Handling job %s for report %s with %s", job.id, job.report)
             handler(job.payload, job.recipient)
         job.mark_finished()
     except Exception:

{"golden_diff": "diff --git a/akvo/rsr/views/py_reports/email_report.py b/akvo/rsr/views/py_reports/email_report.py\n--- a/akvo/rsr/views/py_reports/email_report.py\n+++ b/akvo/rsr/views/py_reports/email_report.py\n@@ -16,7 +16,7 @@\n TIMEOUT = timedelta(minutes=30)\n MAX_ATTEMPTS = 3\n HANDLER = {\n-    program_overview_pdf_report.REPORT_NAME: program_overview_excel_report.handle_email_report,\n+    program_overview_pdf_report.REPORT_NAME: program_overview_pdf_report.handle_email_report,\n     program_overview_excel_report.REPORT_NAME: program_overview_excel_report.handle_email_report,\n     program_period_labels_overview_pdf_report.REPORT_NAME: program_period_labels_overview_pdf_report.handle_email_report,\n     results_indicators_with_map_pdf_reports.ORG_PROJECTS_REPORT_NAME: results_indicators_with_map_pdf_reports.handle_org_projects_email_report,\n@@ -35,6 +35,7 @@\n     try:\n         handler = HANDLER.get(job.report, None)\n         if handler:\n+            logger.info(\"Handling job %s for report %s with %s\", job.id, job.report)\n             handler(job.payload, job.recipient)\n         job.mark_finished()\n     except Exception:\n", "issue": "Program PDF report returns an XLS report\n# What were you doing?\n\nFollow the steps in test \"Download PDF Program overview\".\n\n# What should've happened?\n\nA PDF report should've been received in the email, but an XLS report was delivered.\n", "before_files": [{"content": "import logging\n\nfrom datetime import timedelta\nfrom django.db.models import Q\nfrom django.utils.timezone import now\nfrom akvo.rsr.models import EmailReportJob\n\nfrom . import (\n    program_overview_pdf_report,\n    program_overview_excel_report,\n    program_period_labels_overview_pdf_report,\n    results_indicators_with_map_pdf_reports,\n    nuffic_country_level_map_report,\n)\n\nTIMEOUT = timedelta(minutes=30)\nMAX_ATTEMPTS = 3\nHANDLER = {\n    program_overview_pdf_report.REPORT_NAME: program_overview_excel_report.handle_email_report,\n    program_overview_excel_report.REPORT_NAME: program_overview_excel_report.handle_email_report,\n    program_period_labels_overview_pdf_report.REPORT_NAME: program_period_labels_overview_pdf_report.handle_email_report,\n    results_indicators_with_map_pdf_reports.ORG_PROJECTS_REPORT_NAME: results_indicators_with_map_pdf_reports.handle_org_projects_email_report,\n    nuffic_country_level_map_report.REPORT_NAME: nuffic_country_level_map_report.handle_email_report,\n}\n\nlogger = logging.getLogger(__name__)\n\n\ndef run_job():\n    pending_jobs = _get_pending_jobs()\n    if not pending_jobs.exists():\n        return\n    job = pending_jobs.first()\n    job.mark_started()\n    try:\n        handler = HANDLER.get(job.report, None)\n        if handler:\n            handler(job.payload, job.recipient)\n        job.mark_finished()\n    except Exception:\n        logger.exception(f'Failed to genereate report {job.report} for {job.recipient}')\n\n\ndef _get_pending_jobs():\n    started_timeout = now() - TIMEOUT\n    return EmailReportJob.objects\\\n        .order_by('created_at')\\\n        .filter(finished_at__isnull=True)\\\n        .exclude(Q(attempts__gte=MAX_ATTEMPTS) | Q(started_at__gte=started_timeout))\n", "path": "akvo/rsr/views/py_reports/email_report.py"}], "after_files": [{"content": "import logging\n\nfrom datetime import timedelta\nfrom django.db.models import Q\nfrom django.utils.timezone import now\nfrom akvo.rsr.models import EmailReportJob\n\nfrom . import (\n    program_overview_pdf_report,\n    program_overview_excel_report,\n    program_period_labels_overview_pdf_report,\n    results_indicators_with_map_pdf_reports,\n    nuffic_country_level_map_report,\n)\n\nTIMEOUT = timedelta(minutes=30)\nMAX_ATTEMPTS = 3\nHANDLER = {\n    program_overview_pdf_report.REPORT_NAME: program_overview_pdf_report.handle_email_report,\n    program_overview_excel_report.REPORT_NAME: program_overview_excel_report.handle_email_report,\n    program_period_labels_overview_pdf_report.REPORT_NAME: program_period_labels_overview_pdf_report.handle_email_report,\n    results_indicators_with_map_pdf_reports.ORG_PROJECTS_REPORT_NAME: results_indicators_with_map_pdf_reports.handle_org_projects_email_report,\n    nuffic_country_level_map_report.REPORT_NAME: nuffic_country_level_map_report.handle_email_report,\n}\n\nlogger = logging.getLogger(__name__)\n\n\ndef run_job():\n    pending_jobs = _get_pending_jobs()\n    if not pending_jobs.exists():\n        return\n    job = pending_jobs.first()\n    job.mark_started()\n    try:\n        handler = HANDLER.get(job.report, None)\n        if handler:\n            logger.info(\"Handling job %s for report %s with %s\", job.id, job.report)\n            handler(job.payload, job.recipient)\n        job.mark_finished()\n    except Exception:\n        logger.exception(f'Failed to genereate report {job.report} for {job.recipient}')\n\n\ndef _get_pending_jobs():\n    started_timeout = now() - TIMEOUT\n    return EmailReportJob.objects\\\n        .order_by('created_at')\\\n        .filter(finished_at__isnull=True)\\\n        .exclude(Q(attempts__gte=MAX_ATTEMPTS) | Q(started_at__gte=started_timeout))\n", "path": "akvo/rsr/views/py_reports/email_report.py"}]}