[WEB-1042] fix: dashboard collaborators active issue count (#4256)

* chore: recent collaborators based on workspace

* chore: removed the duplicate issue
This commit is contained in:
Bavisetti Narayan 2024-04-23 13:04:14 +05:30 committed by GitHub
parent f7d6219bd1
commit aee48f6fa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -571,14 +571,16 @@ def dashboard_recent_collaborators(self, request, slug):
return self.paginate( return self.paginate(
request=request, request=request,
queryset=project_members_with_activities, queryset=project_members_with_activities,
controller=self.get_results_controller, controller=lambda qs: self.get_results_controller(qs, slug),
) )
class DashboardEndpoint(BaseAPIView): class DashboardEndpoint(BaseAPIView):
def get_results_controller(self, project_members_with_activities): def get_results_controller(self, project_members_with_activities, slug):
user_active_issue_counts = ( user_active_issue_counts = (
User.objects.filter(id__in=project_members_with_activities) User.objects.filter(
id__in=project_members_with_activities,
)
.annotate( .annotate(
active_issue_count=Count( active_issue_count=Count(
Case( Case(
@ -587,10 +589,13 @@ class DashboardEndpoint(BaseAPIView):
"unstarted", "unstarted",
"started", "started",
], ],
then=1, issue_assignee__issue__workspace__slug=slug,
issue_assignee__issue__project__project_projectmember__is_active=True,
then=F("issue_assignee__issue__id"),
), ),
output_field=IntegerField(), output_field=IntegerField(),
) ),
distinct=True,
) )
) )
.values("active_issue_count", user_id=F("id")) .values("active_issue_count", user_id=F("id"))

View File

@ -15,7 +15,7 @@ class Command(BaseCommand):
receiver_email = options.get("to_email") receiver_email = options.get("to_email")
if not receiver_email: if not receiver_email:
raise CommandError("Reciever email is required") raise CommandError("Receiver email is required")
( (
EMAIL_HOST, EMAIL_HOST,
@ -54,7 +54,7 @@ class Command(BaseCommand):
connection=connection, connection=connection,
) )
msg.send() msg.send()
self.stdout.write(self.style.SUCCESS("Email succesfully sent")) self.stdout.write(self.style.SUCCESS("Email successfully sent"))
except Exception as e: except Exception as e:
self.stdout.write( self.stdout.write(
self.style.ERROR( self.style.ERROR(