mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
feat: user cycle stats (#1723)
* feat: user cycle stats * dev: revert capture exception
This commit is contained in:
parent
f42f2465a9
commit
ff3f1897bc
@ -73,7 +73,7 @@ from plane.db.models import (
|
|||||||
IssueSubscriber,
|
IssueSubscriber,
|
||||||
Project,
|
Project,
|
||||||
Label,
|
Label,
|
||||||
State,
|
CycleIssue,
|
||||||
)
|
)
|
||||||
from plane.api.permissions import (
|
from plane.api.permissions import (
|
||||||
WorkSpaceBasePermission,
|
WorkSpaceBasePermission,
|
||||||
@ -1140,6 +1140,19 @@ class WorkspaceUserProfileStatsEndpoint(BaseAPIView):
|
|||||||
.count()
|
.count()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
upcoming_cycles = CycleIssue.objects.filter(
|
||||||
|
workspace__slug=slug,
|
||||||
|
cycle__start_date__gt=timezone.now().date(),
|
||||||
|
issue__assignees__in=[user_id,]
|
||||||
|
).values("cycle__name", "cycle__id", "cycle__project_id")
|
||||||
|
|
||||||
|
present_cycle = CycleIssue.objects.filter(
|
||||||
|
workspace__slug=slug,
|
||||||
|
cycle__start_date__lt=timezone.now().date(),
|
||||||
|
cycle__end_date__gt=timezone.now().date(),
|
||||||
|
issue__assignees__in=[user_id,]
|
||||||
|
).values("cycle__name", "cycle__id", "cycle__project_id")
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
"state_distribution": state_distribution,
|
"state_distribution": state_distribution,
|
||||||
@ -1149,6 +1162,8 @@ class WorkspaceUserProfileStatsEndpoint(BaseAPIView):
|
|||||||
"completed_issues": completed_issues_count,
|
"completed_issues": completed_issues_count,
|
||||||
"pending_issues": pending_issues_count,
|
"pending_issues": pending_issues_count,
|
||||||
"subscribed_issues": subscribed_issues_count,
|
"subscribed_issues": subscribed_issues_count,
|
||||||
|
"present_cycles": present_cycle,
|
||||||
|
"upcoming_cycles": upcoming_cycles,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -1394,6 +1409,7 @@ class WorkspaceUserProfileIssuesEndpoint(BaseAPIView):
|
|||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class WorkspaceLabelsEndpoint(BaseAPIView):
|
class WorkspaceLabelsEndpoint(BaseAPIView):
|
||||||
permission_classes = [
|
permission_classes = [
|
||||||
WorkspaceEntityPermission,
|
WorkspaceEntityPermission,
|
||||||
|
Loading…
Reference in New Issue
Block a user