prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Engineering: Back-end - Combine logic for Agency Index and Getting Started page
  _As a MST Senior Rider, when I go to benefits.calitp.org, I should see the new Introduction page design and content._
  
  - Change the app logic to the following -
  1. When there is only 1 transit agency, go directly to the agency index page (/mst)
  2. From the agency index page, go directly to the verifier selection page (/eligibility/)
  3. When there is only 1 eligibility verifier, go directly to the only start page (Login.gov verifier)
  
  - Write tests for this new logic
  - Update sample data for this new logic (??) so we can adequately test this in Dev, Staging
  
  ## How it is now
  
  ```mermaid
  graph LR
      A[core:index] -->|redirect| B(core:agency_index)
      B -->|user clicks button| C(eligiblity:index)
      C -->|redirect| D(eligibility:start)
  ```
  
  ## After this is implemented
  
  ```mermaid
  graph LR
      A[core:index] -->|redirect| B(core:agency_index)
      B -->|*redirect*| C(eligiblity:index)
      C -->|redirect| D(eligibility:start)
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `benefits/core/views.py`
  Content:
  ```
  1 """
  2 The core application: view definition for the root of the webapp.
  3 """
  4 from django.http import HttpResponseBadRequest, HttpResponseNotFound, HttpResponseServerError
  5 from django.shortcuts import redirect
  6 from django.template import loader
  7 from django.template.response import TemplateResponse
  8 from django.urls import reverse
  9 from django.utils.translation import gettext as _
  10 
  11 from . import models, session, viewmodels
  12 from .middleware import pageview_decorator
  13 
  14 
  15 def PageTemplateResponse(request, page_vm):
  16     """Helper returns a TemplateResponse using the common page template."""
  17     return TemplateResponse(request, "core/page.html", page_vm.context_dict())
  18 
  19 
  20 def _index_content_title():
  21     """Helper returns the content title for the common index page."""
  22     return _("core.pages.index.content_title")
  23 
  24 
  25 def _index_url():
  26     """Helper computes the index url path."""
  27     return reverse("core:index")
  28 
  29 
  30 @pageview_decorator
  31 def index(request):
  32     """View handler for the main entry page."""
  33     session.reset(request)
  34 
  35     agencies = models.TransitAgency.all_active()
  36 
  37     if len(agencies) == 1:
  38         agency = agencies[0]
  39         return redirect(agency.index_url)
  40 
  41     # generate a button to the landing page for each active agency
  42     buttons = [viewmodels.Button.outline_primary(text=a.short_name, url=a.index_url) for a in agencies]
  43     buttons[0].classes.append("mt-3")
  44     buttons[0].label = _("core.pages.index.chooseprovider")
  45 
  46     page = viewmodels.Page(
  47         title=_("core.pages.index.title"),
  48         content_title=_index_content_title(),
  49         buttons=buttons,
  50         classes="home",
  51     )
  52 
  53     return PageTemplateResponse(request, page)
  54 
  55 
  56 @pageview_decorator
  57 def agency_index(request, agency):
  58     """View handler for an agency entry page."""
  59     session.reset(request)
  60     session.update(request, agency=agency, origin=agency.index_url)
  61 
  62     button = viewmodels.Button.primary(text=_("core.pages.index.continue"), url=reverse("eligibility:index"))
  63     button.label = _("core.pages.agency_index.button.label")
  64 
  65     page = viewmodels.Page(
  66         title=_("core.pages.agency_index.title"),
  67         content_title=_("core.pages.agency_index.content_title"),
  68         button=button,
  69         classes="home",
  70     )
  71 
  72     help_page = reverse("core:help")
  73     context_dict = {**page.context_dict(), **{"info_link": f"{help_page}#about"}}
  74 
  75     return TemplateResponse(request, "core/agency_index.html", context_dict)
  76 
  77 
  78 @pageview_decorator
  79 def help(request):
  80     """View handler for the help page."""
  81     if session.active_agency(request):
  82         agency = session.agency(request)
  83         buttons = viewmodels.Button.agency_contact_links(agency)
  84     else:
  85         buttons = [btn for a in models.TransitAgency.all_active() for btn in viewmodels.Button.agency_contact_links(a)]
  86 
  87     buttons.append(viewmodels.Button.home(request, _("core.buttons.back")))
  88 
  89     page = viewmodels.Page(
  90         title=_("core.buttons.help"),
  91         content_title=_("core.buttons.help"),
  92         buttons=buttons,
  93         noimage=True,
  94     )
  95 
  96     return TemplateResponse(request, "core/help.html", page.context_dict())
  97 
  98 
  99 @pageview_decorator
  100 def bad_request(request, exception, template_name="400.html"):
  101     """View handler for HTTP 400 Bad Request responses."""
  102     if session.active_agency(request):
  103         session.update(request, origin=session.agency(request).index_url)
  104     else:
  105         session.update(request, origin=_index_url())
  106 
  107     home = viewmodels.Button.home(request)
  108     page = viewmodels.ErrorPage.error(button=home)
  109     t = loader.get_template(template_name)
  110 
  111     return HttpResponseBadRequest(t.render(page.context_dict()))
  112 
  113 
  114 @pageview_decorator
  115 def csrf_failure(request, reason):
  116     """
  117     View handler for CSRF_FAILURE_VIEW with custom data.
  118     """
  119     if session.active_agency(request):
  120         session.update(request, origin=session.agency(request).index_url)
  121     else:
  122         session.update(request, origin=_index_url())
  123 
  124     home = viewmodels.Button.home(request)
  125     page = viewmodels.ErrorPage.not_found(button=home, path=request.path)
  126     t = loader.get_template("400.html")
  127 
  128     return HttpResponseNotFound(t.render(page.context_dict()))
  129 
  130 
  131 @pageview_decorator
  132 def page_not_found(request, exception, template_name="404.html"):
  133     """View handler for HTTP 404 Not Found responses."""
  134     if session.active_agency(request):
  135         session.update(request, origin=session.agency(request).index_url)
  136     else:
  137         session.update(request, origin=_index_url())
  138 
  139     home = viewmodels.Button.home(request)
  140     page = viewmodels.ErrorPage.not_found(button=home, path=request.path)
  141     t = loader.get_template(template_name)
  142 
  143     return HttpResponseNotFound(t.render(page.context_dict()))
  144 
  145 
  146 @pageview_decorator
  147 def server_error(request, template_name="500.html"):
  148     """View handler for HTTP 500 Server Error responses."""
  149     if session.active_agency(request):
  150         session.update(request, origin=session.agency(request).index_url)
  151     else:
  152         session.update(request, origin=_index_url())
  153 
  154     home = viewmodels.Button.home(request)
  155     page = viewmodels.ErrorPage.error(button=home)
  156     t = loader.get_template(template_name)
  157 
  158     return HttpResponseServerError(t.render(page.context_dict()))
  159
  ```
  --- 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/benefits/core/views.py b/benefits/core/views.py
  --- a/benefits/core/views.py
  +++ b/benefits/core/views.py
  @@ -59,6 +59,9 @@
       session.reset(request)
       session.update(request, agency=agency, origin=agency.index_url)
   
  +    if len(agency.eligibility_verifiers.all()) == 1:
  +        return redirect(reverse("eligibility:index"))
  +
       button = viewmodels.Button.primary(text=_("core.pages.index.continue"), url=reverse("eligibility:index"))
       button.label = _("core.pages.agency_index.button.label")
  
verification_info: {"golden_diff": "diff --git a/benefits/core/views.py b/benefits/core/views.py\n--- a/benefits/core/views.py\n+++ b/benefits/core/views.py\n@@ -59,6 +59,9 @@\n     session.reset(request)\n     session.update(request, agency=agency, origin=agency.index_url)\n \n+    if len(agency.eligibility_verifiers.all()) == 1:\n+        return redirect(reverse(\"eligibility:index\"))\n+\n     button = viewmodels.Button.primary(text=_(\"core.pages.index.continue\"), url=reverse(\"eligibility:index\"))\n     button.label = _(\"core.pages.agency_index.button.label\")\n", "issue": "Engineering: Back-end - Combine logic for Agency Index and Getting Started page\n_As a MST Senior Rider, when I go to benefits.calitp.org, I should see the new Introduction page design and content._\r\n\r\n- Change the app logic to the following -\r\n1. When there is only 1 transit agency, go directly to the agency index page (/mst)\r\n2. From the agency index page, go directly to the verifier selection page (/eligibility/)\r\n3. When there is only 1 eligibility verifier, go directly to the only start page (Login.gov verifier)\r\n\r\n- Write tests for this new logic\r\n- Update sample data for this new logic (??) so we can adequately test this in Dev, Staging\r\n\r\n## How it is now\r\n\r\n```mermaid\r\ngraph LR\r\n    A[core:index] -->|redirect| B(core:agency_index)\r\n    B -->|user clicks button| C(eligiblity:index)\r\n    C -->|redirect| D(eligibility:start)\r\n```\r\n\r\n## After this is implemented\r\n\r\n```mermaid\r\ngraph LR\r\n    A[core:index] -->|redirect| B(core:agency_index)\r\n    B -->|*redirect*| C(eligiblity:index)\r\n    C -->|redirect| D(eligibility:start)\r\n```\r\n\n", "before_files": [{"content": "\"\"\"\nThe core application: view definition for the root of the webapp.\n\"\"\"\nfrom django.http import HttpResponseBadRequest, HttpResponseNotFound, HttpResponseServerError\nfrom django.shortcuts import redirect\nfrom django.template import loader\nfrom django.template.response import TemplateResponse\nfrom django.urls import reverse\nfrom django.utils.translation import gettext as _\n\nfrom . import models, session, viewmodels\nfrom .middleware import pageview_decorator\n\n\ndef PageTemplateResponse(request, page_vm):\n    \"\"\"Helper returns a TemplateResponse using the common page template.\"\"\"\n    return TemplateResponse(request, \"core/page.html\", page_vm.context_dict())\n\n\ndef _index_content_title():\n    \"\"\"Helper returns the content title for the common index page.\"\"\"\n    return _(\"core.pages.index.content_title\")\n\n\ndef _index_url():\n    \"\"\"Helper computes the index url path.\"\"\"\n    return reverse(\"core:index\")\n\n\n@pageview_decorator\ndef index(request):\n    \"\"\"View handler for the main entry page.\"\"\"\n    session.reset(request)\n\n    agencies = models.TransitAgency.all_active()\n\n    if len(agencies) == 1:\n        agency = agencies[0]\n        return redirect(agency.index_url)\n\n    # generate a button to the landing page for each active agency\n    buttons = [viewmodels.Button.outline_primary(text=a.short_name, url=a.index_url) for a in agencies]\n    buttons[0].classes.append(\"mt-3\")\n    buttons[0].label = _(\"core.pages.index.chooseprovider\")\n\n    page = viewmodels.Page(\n        title=_(\"core.pages.index.title\"),\n        content_title=_index_content_title(),\n        buttons=buttons,\n        classes=\"home\",\n    )\n\n    return PageTemplateResponse(request, page)\n\n\n@pageview_decorator\ndef agency_index(request, agency):\n    \"\"\"View handler for an agency entry page.\"\"\"\n    session.reset(request)\n    session.update(request, agency=agency, origin=agency.index_url)\n\n    button = viewmodels.Button.primary(text=_(\"core.pages.index.continue\"), url=reverse(\"eligibility:index\"))\n    button.label = _(\"core.pages.agency_index.button.label\")\n\n    page = viewmodels.Page(\n        title=_(\"core.pages.agency_index.title\"),\n        content_title=_(\"core.pages.agency_index.content_title\"),\n        button=button,\n        classes=\"home\",\n    )\n\n    help_page = reverse(\"core:help\")\n    context_dict = {**page.context_dict(), **{\"info_link\": f\"{help_page}#about\"}}\n\n    return TemplateResponse(request, \"core/agency_index.html\", context_dict)\n\n\n@pageview_decorator\ndef help(request):\n    \"\"\"View handler for the help page.\"\"\"\n    if session.active_agency(request):\n        agency = session.agency(request)\n        buttons = viewmodels.Button.agency_contact_links(agency)\n    else:\n        buttons = [btn for a in models.TransitAgency.all_active() for btn in viewmodels.Button.agency_contact_links(a)]\n\n    buttons.append(viewmodels.Button.home(request, _(\"core.buttons.back\")))\n\n    page = viewmodels.Page(\n        title=_(\"core.buttons.help\"),\n        content_title=_(\"core.buttons.help\"),\n        buttons=buttons,\n        noimage=True,\n    )\n\n    return TemplateResponse(request, \"core/help.html\", page.context_dict())\n\n\n@pageview_decorator\ndef bad_request(request, exception, template_name=\"400.html\"):\n    \"\"\"View handler for HTTP 400 Bad Request responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.error(button=home)\n    t = loader.get_template(template_name)\n\n    return HttpResponseBadRequest(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef csrf_failure(request, reason):\n    \"\"\"\n    View handler for CSRF_FAILURE_VIEW with custom data.\n    \"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.not_found(button=home, path=request.path)\n    t = loader.get_template(\"400.html\")\n\n    return HttpResponseNotFound(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef page_not_found(request, exception, template_name=\"404.html\"):\n    \"\"\"View handler for HTTP 404 Not Found responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.not_found(button=home, path=request.path)\n    t = loader.get_template(template_name)\n\n    return HttpResponseNotFound(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef server_error(request, template_name=\"500.html\"):\n    \"\"\"View handler for HTTP 500 Server Error responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.error(button=home)\n    t = loader.get_template(template_name)\n\n    return HttpResponseServerError(t.render(page.context_dict()))\n", "path": "benefits/core/views.py"}], "after_files": [{"content": "\"\"\"\nThe core application: view definition for the root of the webapp.\n\"\"\"\nfrom django.http import HttpResponseBadRequest, HttpResponseNotFound, HttpResponseServerError\nfrom django.shortcuts import redirect\nfrom django.template import loader\nfrom django.template.response import TemplateResponse\nfrom django.urls import reverse\nfrom django.utils.translation import gettext as _\n\nfrom . import models, session, viewmodels\nfrom .middleware import pageview_decorator\n\n\ndef PageTemplateResponse(request, page_vm):\n    \"\"\"Helper returns a TemplateResponse using the common page template.\"\"\"\n    return TemplateResponse(request, \"core/page.html\", page_vm.context_dict())\n\n\ndef _index_content_title():\n    \"\"\"Helper returns the content title for the common index page.\"\"\"\n    return _(\"core.pages.index.content_title\")\n\n\ndef _index_url():\n    \"\"\"Helper computes the index url path.\"\"\"\n    return reverse(\"core:index\")\n\n\n@pageview_decorator\ndef index(request):\n    \"\"\"View handler for the main entry page.\"\"\"\n    session.reset(request)\n\n    agencies = models.TransitAgency.all_active()\n\n    if len(agencies) == 1:\n        agency = agencies[0]\n        return redirect(agency.index_url)\n\n    # generate a button to the landing page for each active agency\n    buttons = [viewmodels.Button.outline_primary(text=a.short_name, url=a.index_url) for a in agencies]\n    buttons[0].classes.append(\"mt-3\")\n    buttons[0].label = _(\"core.pages.index.chooseprovider\")\n\n    page = viewmodels.Page(\n        title=_(\"core.pages.index.title\"),\n        content_title=_index_content_title(),\n        buttons=buttons,\n        classes=\"home\",\n    )\n\n    return PageTemplateResponse(request, page)\n\n\n@pageview_decorator\ndef agency_index(request, agency):\n    \"\"\"View handler for an agency entry page.\"\"\"\n    session.reset(request)\n    session.update(request, agency=agency, origin=agency.index_url)\n\n    if len(agency.eligibility_verifiers.all()) == 1:\n        return redirect(reverse(\"eligibility:index\"))\n\n    button = viewmodels.Button.primary(text=_(\"core.pages.index.continue\"), url=reverse(\"eligibility:index\"))\n    button.label = _(\"core.pages.agency_index.button.label\")\n\n    page = viewmodels.Page(\n        title=_(\"core.pages.agency_index.title\"),\n        content_title=_(\"core.pages.agency_index.content_title\"),\n        button=button,\n        classes=\"home\",\n    )\n\n    help_page = reverse(\"core:help\")\n    context_dict = {**page.context_dict(), **{\"info_link\": f\"{help_page}#about\"}}\n\n    return TemplateResponse(request, \"core/agency_index.html\", context_dict)\n\n\n@pageview_decorator\ndef help(request):\n    \"\"\"View handler for the help page.\"\"\"\n    if session.active_agency(request):\n        agency = session.agency(request)\n        buttons = viewmodels.Button.agency_contact_links(agency)\n    else:\n        buttons = [btn for a in models.TransitAgency.all_active() for btn in viewmodels.Button.agency_contact_links(a)]\n\n    buttons.append(viewmodels.Button.home(request, _(\"core.buttons.back\")))\n\n    page = viewmodels.Page(\n        title=_(\"core.buttons.help\"),\n        content_title=_(\"core.buttons.help\"),\n        buttons=buttons,\n        noimage=True,\n    )\n\n    return TemplateResponse(request, \"core/help.html\", page.context_dict())\n\n\n@pageview_decorator\ndef bad_request(request, exception, template_name=\"400.html\"):\n    \"\"\"View handler for HTTP 400 Bad Request responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.error(button=home)\n    t = loader.get_template(template_name)\n\n    return HttpResponseBadRequest(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef csrf_failure(request, reason):\n    \"\"\"\n    View handler for CSRF_FAILURE_VIEW with custom data.\n    \"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.not_found(button=home, path=request.path)\n    t = loader.get_template(\"400.html\")\n\n    return HttpResponseNotFound(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef page_not_found(request, exception, template_name=\"404.html\"):\n    \"\"\"View handler for HTTP 404 Not Found responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.not_found(button=home, path=request.path)\n    t = loader.get_template(template_name)\n\n    return HttpResponseNotFound(t.render(page.context_dict()))\n\n\n@pageview_decorator\ndef server_error(request, template_name=\"500.html\"):\n    \"\"\"View handler for HTTP 500 Server Error responses.\"\"\"\n    if session.active_agency(request):\n        session.update(request, origin=session.agency(request).index_url)\n    else:\n        session.update(request, origin=_index_url())\n\n    home = viewmodels.Button.home(request)\n    page = viewmodels.ErrorPage.error(button=home)\n    t = loader.get_template(template_name)\n\n    return HttpResponseServerError(t.render(page.context_dict()))\n", "path": "benefits/core/views.py"}]}