forked from github/plane
fix: module endpoint validations (#4071)
This commit is contained in:
parent
f3d9053d81
commit
4c46b075b4
@ -1,54 +1,57 @@
|
|||||||
# Python imports
|
# Python imports
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# Django Imports
|
|
||||||
from django.utils import timezone
|
|
||||||
from django.db.models import (
|
|
||||||
Prefetch,
|
|
||||||
F,
|
|
||||||
OuterRef,
|
|
||||||
Exists,
|
|
||||||
Count,
|
|
||||||
Q,
|
|
||||||
Func,
|
|
||||||
Subquery,
|
|
||||||
IntegerField,
|
|
||||||
)
|
|
||||||
from django.contrib.postgres.aggregates import ArrayAgg
|
from django.contrib.postgres.aggregates import ArrayAgg
|
||||||
from django.contrib.postgres.fields import ArrayField
|
from django.contrib.postgres.fields import ArrayField
|
||||||
from django.db.models import Value, UUIDField
|
from django.db.models import (
|
||||||
|
Count,
|
||||||
|
Exists,
|
||||||
|
F,
|
||||||
|
Func,
|
||||||
|
IntegerField,
|
||||||
|
OuterRef,
|
||||||
|
Prefetch,
|
||||||
|
Q,
|
||||||
|
Subquery,
|
||||||
|
UUIDField,
|
||||||
|
Value,
|
||||||
|
)
|
||||||
from django.db.models.functions import Coalesce
|
from django.db.models.functions import Coalesce
|
||||||
|
|
||||||
|
# Django Imports
|
||||||
|
from django.utils import timezone
|
||||||
|
from rest_framework import status
|
||||||
|
|
||||||
# Third party imports
|
# Third party imports
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import status
|
|
||||||
|
|
||||||
# Module imports
|
|
||||||
from .. import BaseViewSet, BaseAPIView, WebhookMixin
|
|
||||||
from plane.app.serializers import (
|
|
||||||
ModuleWriteSerializer,
|
|
||||||
ModuleSerializer,
|
|
||||||
ModuleLinkSerializer,
|
|
||||||
ModuleFavoriteSerializer,
|
|
||||||
ModuleUserPropertiesSerializer,
|
|
||||||
ModuleDetailSerializer,
|
|
||||||
)
|
|
||||||
from plane.app.permissions import (
|
from plane.app.permissions import (
|
||||||
ProjectEntityPermission,
|
ProjectEntityPermission,
|
||||||
ProjectLitePermission,
|
ProjectLitePermission,
|
||||||
)
|
)
|
||||||
from plane.db.models import (
|
from plane.app.serializers import (
|
||||||
Module,
|
ModuleDetailSerializer,
|
||||||
ModuleIssue,
|
ModuleFavoriteSerializer,
|
||||||
Project,
|
ModuleLinkSerializer,
|
||||||
Issue,
|
ModuleSerializer,
|
||||||
ModuleLink,
|
ModuleUserPropertiesSerializer,
|
||||||
ModuleFavorite,
|
ModuleWriteSerializer,
|
||||||
ModuleUserProperties,
|
|
||||||
)
|
)
|
||||||
from plane.bgtasks.issue_activites_task import issue_activity
|
from plane.bgtasks.issue_activites_task import issue_activity
|
||||||
|
from plane.db.models import (
|
||||||
|
Issue,
|
||||||
|
Module,
|
||||||
|
ModuleFavorite,
|
||||||
|
ModuleIssue,
|
||||||
|
ModuleLink,
|
||||||
|
ModuleUserProperties,
|
||||||
|
Project,
|
||||||
|
)
|
||||||
from plane.utils.analytics_plot import burndown_plot
|
from plane.utils.analytics_plot import burndown_plot
|
||||||
|
|
||||||
|
# Module imports
|
||||||
|
from .. import BaseAPIView, BaseViewSet, WebhookMixin
|
||||||
|
|
||||||
|
|
||||||
class ModuleViewSet(WebhookMixin, BaseViewSet):
|
class ModuleViewSet(WebhookMixin, BaseViewSet):
|
||||||
model = Module
|
model = Module
|
||||||
@ -392,9 +395,11 @@ class ModuleViewSet(WebhookMixin, BaseViewSet):
|
|||||||
"completion_chart": {},
|
"completion_chart": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
if queryset.first().start_date and queryset.first().target_date:
|
# Fetch the modules
|
||||||
|
modules = queryset.first()
|
||||||
|
if modules and modules.start_date and modules.target_date:
|
||||||
data["distribution"]["completion_chart"] = burndown_plot(
|
data["distribution"]["completion_chart"] = burndown_plot(
|
||||||
queryset=queryset.first(),
|
queryset=modules,
|
||||||
slug=slug,
|
slug=slug,
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
module_id=pk,
|
module_id=pk,
|
||||||
|
@ -3,15 +3,10 @@ from rest_framework import status
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
|
from plane.app.permissions import WorkspaceEntityPermission
|
||||||
from plane.app.serializers import WorkspaceEstimateSerializer
|
from plane.app.serializers import WorkspaceEstimateSerializer
|
||||||
from plane.app.views.base import BaseAPIView
|
from plane.app.views.base import BaseAPIView
|
||||||
from plane.db.models import Project, Estimate
|
from plane.db.models import Estimate, Project
|
||||||
from plane.app.permissions import WorkspaceEntityPermission
|
|
||||||
|
|
||||||
# Django imports
|
|
||||||
from django.db.models import (
|
|
||||||
Prefetch,
|
|
||||||
)
|
|
||||||
from plane.utils.cache import cache_response
|
from plane.utils.cache import cache_response
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user