chore: delete the estimate points in cycle

This commit is contained in:
NarayanBavisetti
2024-10-17 22:38:50 +05:30
parent fd3107f187
commit a0ba164521

View File

@@ -387,24 +387,24 @@ class EstimatePointEndpoint(BaseViewSet):
project_id=project_id,
workspace__slug=slug,
).first()
if new_estimate_id:
if cycle and cycle.version == 2:
new_estimate_value = (
EstimatePoint.objects.filter(pk=new_estimate_id)
.values_list("value", flat=True)
.first()
.value
)
issues = Issue.objects.annotate(
cycle_id=F("issue_cycle__cycle_id")
).filter(estimate_point_id=new_estimate_id, cycle_id=cycle.id)
else:
issues = Issue.objects.annotate(
cycle_id=F("issue_cycle__cycle_id")
).filter(
estimate_point_id=estimate_point_id, cycle_id=cycle.id
if new_estimate_id
else None
)
issues = Issue.objects.filter(
estimate_point_id=(
new_estimate_id
if new_estimate_id
else estimate_point_id
),
issue_cycle__cycle_id=cycle.id,
)
if cycle.version == 2:
EntityIssueStateActivity.objects.bulk_create(
[
EntityIssueStateActivity(
@@ -414,12 +414,8 @@ class EstimatePointEndpoint(BaseViewSet):
state_group=issue.state.group,
action="UPDATED",
entity_type="CYCLE",
estimate_point_id=(
new_estimate_id if new_estimate_id else None
),
estimate_value=(
new_estimate_value if new_estimate_id else None
),
estimate_point_id=new_estimate_id,
estimate_value=new_estimate_value,
workspace_id=issue.workspace_id,
created_by_id=request.user.id,
updated_by_id=request.user.id,