prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Admin Event Tab / All Events Tab missing Session Information
  **Describe the bug**
  The admin events tab and the events tab are missing session information. It shows "0" for different statuses.
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. Go to `/admin/events/past`
  2. See incorrect number of submitted sessions. 
  
  **Expected behavior**
  Should show total sessions
  
  
  **Additional context**
  Working on this.
  
  --- 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/schema/event_statistics.py`
  Content:
  ```
  1 from marshmallow_jsonapi import fields
  2 from marshmallow_jsonapi.flask import Schema
  3 
  4 from app.api.helpers.utilities import dasherize
  5 from app.models.session import Session
  6 from app.models.speaker import Speaker
  7 from app.models.sponsor import Sponsor
  8 from app.models.session_speaker_link import SessionsSpeakersLink
  9 
  10 
  11 class EventStatisticsGeneralSchema(Schema):
  12     """
  13     Api schema for general statistics of event
  14     """
  15     class Meta:
  16         """
  17         Meta class
  18         """
  19         type_ = 'event-statistics-general'
  20         self_view = 'v1.event_statistics_general_detail'
  21         self_view_kwargs = {'id': '<id>'}
  22         inflect = dasherize
  23 
  24     id = fields.Str()
  25     identifier = fields.Str()
  26     sessions_draft = fields.Method("sessions_draft_count")
  27     sessions_submitted = fields.Method("sessions_submitted_count")
  28     sessions_accepted = fields.Method("sessions_accepted_count")
  29     sessions_confirmed = fields.Method("sessions_confirmed_count")
  30     sessions_pending = fields.Method("sessions_pending_count")
  31     sessions_rejected = fields.Method("sessions_rejected_count")
  32     speakers = fields.Method("speakers_count")
  33     sessions = fields.Method("sessions_count")
  34     sponsors = fields.Method("sponsors_count")
  35 
  36     def sessions_draft_count(self, obj):
  37         return Session.query.filter_by(event_id=obj.id, state='draft').count()
  38 
  39     def sessions_submitted_count(self, obj):
  40         return Session.query.filter_by(event_id=obj.id, state='submitted').count()
  41 
  42     def sessions_accepted_count(self, obj):
  43         return Session.query.filter_by(event_id=obj.id, state='accepted').count()
  44 
  45     def sessions_confirmed_count(self, obj):
  46         return Session.query.filter_by(event_id=obj.id, state='confirmed').count()
  47 
  48     def sessions_pending_count(self, obj):
  49         return Session.query.filter_by(event_id=obj.id, state='pending').count()
  50 
  51     def sessions_rejected_count(self, obj):
  52         return Session.query.filter_by(event_id=obj.id, state='rejected').count()
  53 
  54     def speakers_count_type(self, obj, state='pending'):
  55         return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state).count()
  56 
  57     def speakers_count(self, obj):
  58         accepted = self.speakers_count_type(obj=obj, state='accepted')
  59         confirmed = self.speakers_count_type(obj=obj, state='confirmed')
  60         pending = self.speakers_count_type(obj=obj, state='pending')
  61         rejected = self.speakers_count_type(obj=obj, state='rejected')
  62         total = Speaker.query.filter_by(event_id=obj.id).count()
  63         serial_data = {
  64                        'accepted': accepted,
  65                        'confirmed': confirmed,
  66                        'pending': pending,
  67                        'rejected': rejected,
  68                        'total': total
  69                        }
  70         return serial_data
  71 
  72     def sessions_count(self, obj):
  73         return Session.query.filter_by(event_id=obj.id).count()
  74 
  75     def sponsors_count(self, obj):
  76         return Sponsor.query.filter_by(event_id=obj.id).count()
  77
  ```
  --- 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/schema/event_statistics.py b/app/api/schema/event_statistics.py
  --- a/app/api/schema/event_statistics.py
  +++ b/app/api/schema/event_statistics.py
  @@ -34,32 +34,32 @@
       sponsors = fields.Method("sponsors_count")
   
       def sessions_draft_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='draft').count()
  +        return Session.query.filter_by(event_id=obj.id, state='draft', deleted_at=None).count()
   
       def sessions_submitted_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='submitted').count()
  +        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()
   
       def sessions_accepted_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='accepted').count()
  +        return Session.query.filter_by(event_id=obj.id, state='accepted', deleted_at=None).count()
   
       def sessions_confirmed_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='confirmed').count()
  +        return Session.query.filter_by(event_id=obj.id, state='confirmed', deleted_at=None).count()
   
       def sessions_pending_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='pending').count()
  +        return Session.query.filter_by(event_id=obj.id, state='pending', deleted_at=None).count()
   
       def sessions_rejected_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id, state='rejected').count()
  +        return Session.query.filter_by(event_id=obj.id, state='rejected', deleted_at=None).count()
   
       def speakers_count_type(self, obj, state='pending'):
  -        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state).count()
  +        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state, deleted_at=None).count()
   
       def speakers_count(self, obj):
           accepted = self.speakers_count_type(obj=obj, state='accepted')
           confirmed = self.speakers_count_type(obj=obj, state='confirmed')
           pending = self.speakers_count_type(obj=obj, state='pending')
           rejected = self.speakers_count_type(obj=obj, state='rejected')
  -        total = Speaker.query.filter_by(event_id=obj.id).count()
  +        total = Speaker.query.filter_by(event_id=obj.id, deleted_at=None).count()
           serial_data = {
                          'accepted': accepted,
                          'confirmed': confirmed,
  @@ -70,7 +70,7 @@
           return serial_data
   
       def sessions_count(self, obj):
  -        return Session.query.filter_by(event_id=obj.id).count()
  +        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()
   
       def sponsors_count(self, obj):
  -        return Sponsor.query.filter_by(event_id=obj.id).count()
  +        return Sponsor.query.filter_by(event_id=obj.id, deleted_at=None).count()
  
verification_info: {"golden_diff": "diff --git a/app/api/schema/event_statistics.py b/app/api/schema/event_statistics.py\n--- a/app/api/schema/event_statistics.py\n+++ b/app/api/schema/event_statistics.py\n@@ -34,32 +34,32 @@\n     sponsors = fields.Method(\"sponsors_count\")\n \n     def sessions_draft_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='draft').count()\n+        return Session.query.filter_by(event_id=obj.id, state='draft', deleted_at=None).count()\n \n     def sessions_submitted_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='submitted').count()\n+        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()\n \n     def sessions_accepted_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='accepted').count()\n+        return Session.query.filter_by(event_id=obj.id, state='accepted', deleted_at=None).count()\n \n     def sessions_confirmed_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='confirmed').count()\n+        return Session.query.filter_by(event_id=obj.id, state='confirmed', deleted_at=None).count()\n \n     def sessions_pending_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='pending').count()\n+        return Session.query.filter_by(event_id=obj.id, state='pending', deleted_at=None).count()\n \n     def sessions_rejected_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id, state='rejected').count()\n+        return Session.query.filter_by(event_id=obj.id, state='rejected', deleted_at=None).count()\n \n     def speakers_count_type(self, obj, state='pending'):\n-        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state).count()\n+        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state, deleted_at=None).count()\n \n     def speakers_count(self, obj):\n         accepted = self.speakers_count_type(obj=obj, state='accepted')\n         confirmed = self.speakers_count_type(obj=obj, state='confirmed')\n         pending = self.speakers_count_type(obj=obj, state='pending')\n         rejected = self.speakers_count_type(obj=obj, state='rejected')\n-        total = Speaker.query.filter_by(event_id=obj.id).count()\n+        total = Speaker.query.filter_by(event_id=obj.id, deleted_at=None).count()\n         serial_data = {\n                        'accepted': accepted,\n                        'confirmed': confirmed,\n@@ -70,7 +70,7 @@\n         return serial_data\n \n     def sessions_count(self, obj):\n-        return Session.query.filter_by(event_id=obj.id).count()\n+        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()\n \n     def sponsors_count(self, obj):\n-        return Sponsor.query.filter_by(event_id=obj.id).count()\n+        return Sponsor.query.filter_by(event_id=obj.id, deleted_at=None).count()\n", "issue": "Admin Event Tab / All Events Tab missing Session Information\n**Describe the bug**\r\nThe admin events tab and the events tab are missing session information. It shows \"0\" for different statuses.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Go to `/admin/events/past`\r\n2. See incorrect number of submitted sessions. \r\n\r\n**Expected behavior**\r\nShould show total sessions\r\n\r\n\r\n**Additional context**\r\nWorking on this.\n", "before_files": [{"content": "from marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Schema\n\nfrom app.api.helpers.utilities import dasherize\nfrom app.models.session import Session\nfrom app.models.speaker import Speaker\nfrom app.models.sponsor import Sponsor\nfrom app.models.session_speaker_link import SessionsSpeakersLink\n\n\nclass EventStatisticsGeneralSchema(Schema):\n    \"\"\"\n    Api schema for general statistics of event\n    \"\"\"\n    class Meta:\n        \"\"\"\n        Meta class\n        \"\"\"\n        type_ = 'event-statistics-general'\n        self_view = 'v1.event_statistics_general_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Str()\n    identifier = fields.Str()\n    sessions_draft = fields.Method(\"sessions_draft_count\")\n    sessions_submitted = fields.Method(\"sessions_submitted_count\")\n    sessions_accepted = fields.Method(\"sessions_accepted_count\")\n    sessions_confirmed = fields.Method(\"sessions_confirmed_count\")\n    sessions_pending = fields.Method(\"sessions_pending_count\")\n    sessions_rejected = fields.Method(\"sessions_rejected_count\")\n    speakers = fields.Method(\"speakers_count\")\n    sessions = fields.Method(\"sessions_count\")\n    sponsors = fields.Method(\"sponsors_count\")\n\n    def sessions_draft_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='draft').count()\n\n    def sessions_submitted_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='submitted').count()\n\n    def sessions_accepted_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='accepted').count()\n\n    def sessions_confirmed_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='confirmed').count()\n\n    def sessions_pending_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='pending').count()\n\n    def sessions_rejected_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='rejected').count()\n\n    def speakers_count_type(self, obj, state='pending'):\n        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state).count()\n\n    def speakers_count(self, obj):\n        accepted = self.speakers_count_type(obj=obj, state='accepted')\n        confirmed = self.speakers_count_type(obj=obj, state='confirmed')\n        pending = self.speakers_count_type(obj=obj, state='pending')\n        rejected = self.speakers_count_type(obj=obj, state='rejected')\n        total = Speaker.query.filter_by(event_id=obj.id).count()\n        serial_data = {\n                       'accepted': accepted,\n                       'confirmed': confirmed,\n                       'pending': pending,\n                       'rejected': rejected,\n                       'total': total\n                       }\n        return serial_data\n\n    def sessions_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id).count()\n\n    def sponsors_count(self, obj):\n        return Sponsor.query.filter_by(event_id=obj.id).count()\n", "path": "app/api/schema/event_statistics.py"}], "after_files": [{"content": "from marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Schema\n\nfrom app.api.helpers.utilities import dasherize\nfrom app.models.session import Session\nfrom app.models.speaker import Speaker\nfrom app.models.sponsor import Sponsor\nfrom app.models.session_speaker_link import SessionsSpeakersLink\n\n\nclass EventStatisticsGeneralSchema(Schema):\n    \"\"\"\n    Api schema for general statistics of event\n    \"\"\"\n    class Meta:\n        \"\"\"\n        Meta class\n        \"\"\"\n        type_ = 'event-statistics-general'\n        self_view = 'v1.event_statistics_general_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Str()\n    identifier = fields.Str()\n    sessions_draft = fields.Method(\"sessions_draft_count\")\n    sessions_submitted = fields.Method(\"sessions_submitted_count\")\n    sessions_accepted = fields.Method(\"sessions_accepted_count\")\n    sessions_confirmed = fields.Method(\"sessions_confirmed_count\")\n    sessions_pending = fields.Method(\"sessions_pending_count\")\n    sessions_rejected = fields.Method(\"sessions_rejected_count\")\n    speakers = fields.Method(\"speakers_count\")\n    sessions = fields.Method(\"sessions_count\")\n    sponsors = fields.Method(\"sponsors_count\")\n\n    def sessions_draft_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='draft', deleted_at=None).count()\n\n    def sessions_submitted_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()\n\n    def sessions_accepted_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='accepted', deleted_at=None).count()\n\n    def sessions_confirmed_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='confirmed', deleted_at=None).count()\n\n    def sessions_pending_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='pending', deleted_at=None).count()\n\n    def sessions_rejected_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, state='rejected', deleted_at=None).count()\n\n    def speakers_count_type(self, obj, state='pending'):\n        return SessionsSpeakersLink.query.filter_by(event_id=obj.id, session_state=state, deleted_at=None).count()\n\n    def speakers_count(self, obj):\n        accepted = self.speakers_count_type(obj=obj, state='accepted')\n        confirmed = self.speakers_count_type(obj=obj, state='confirmed')\n        pending = self.speakers_count_type(obj=obj, state='pending')\n        rejected = self.speakers_count_type(obj=obj, state='rejected')\n        total = Speaker.query.filter_by(event_id=obj.id, deleted_at=None).count()\n        serial_data = {\n                       'accepted': accepted,\n                       'confirmed': confirmed,\n                       'pending': pending,\n                       'rejected': rejected,\n                       'total': total\n                       }\n        return serial_data\n\n    def sessions_count(self, obj):\n        return Session.query.filter_by(event_id=obj.id, deleted_at=None).count()\n\n    def sponsors_count(self, obj):\n        return Sponsor.query.filter_by(event_id=obj.id, deleted_at=None).count()\n", "path": "app/api/schema/event_statistics.py"}]}