Repository: fossasia/open-event-server

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.


Discussion:

Resolving patch:
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 @@ class Meta:
     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 @@ def speakers_count(self, obj):
         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()


Test patch: