Skip to content

Commit

Permalink
Merge pull request #2211 from gtech-mulearn/dev-server
Browse files Browse the repository at this point in the history
Merge dev-server to production
  • Loading branch information
jelanmathewjames authored Aug 13, 2024
2 parents 927e606 + 6e405db commit 26eb69f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/common/common_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.db.models import Count
from django.db.models import Count, Sum
from django.db.models.functions import Coalesce

from channels.generic.websocket import WebsocketConsumer
Expand All @@ -12,7 +12,7 @@
from db.learning_circle import LearningCircle
from db.learning_circle import UserCircleLink
from db.organization import Organization
from db.task import InterestGroup
from db.task import InterestGroup, KarmaActivityLog
from db.user import User, UserRoleLink

from utils.types import IntegrationType, OrganizationType
Expand Down Expand Up @@ -48,6 +48,10 @@ def interest_groups_count(self):
def learning_circles_count(self):
learning_circles_count = LearningCircle.objects.all().count()
return learning_circles_count

def karma_pow_count(self):
karma_pow_count = KarmaActivityLog.objects.aggregate(karma_count=Coalesce(Sum('karma'), 0), pow_count=Count('id'))
return karma_pow_count

def get_data(self, sender):
if sender == None:
Expand All @@ -56,7 +60,8 @@ def get_data(self, sender):
'org_type_counts': self.org_type_counts(),
'enablers_mentors_count': self.enablers_mentors_count(),
'ig_count': self.interest_groups_count(),
'learning_circle_count': self.learning_circles_count()
'learning_circle_count': self.learning_circles_count(),
'karma_pow_count': self.karma_pow_count()
}
elif sender == User:
self.data['members'] = self.members_count()
Expand Down

0 comments on commit 26eb69f

Please sign in to comment.