From ae9f1a7a94e7f389d27bf2ed57be44a945dce6c1 Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Thu, 6 Jun 2024 12:55:27 +0530 Subject: [PATCH] chore: removed migration file and updated the estimate system order and removed ee banner --- .../db/migrations/0067_auto_20240605_0837.py | 121 ------------------ web/components/estimates/ee-banner.tsx | 47 ------- web/components/estimates/index.ts | 1 - web/components/estimates/root.tsx | 3 - web/constants/estimates.ts | 70 +++++----- 5 files changed, 35 insertions(+), 207 deletions(-) delete mode 100644 apiserver/plane/db/migrations/0067_auto_20240605_0837.py delete mode 100644 web/components/estimates/ee-banner.tsx diff --git a/apiserver/plane/db/migrations/0067_auto_20240605_0837.py b/apiserver/plane/db/migrations/0067_auto_20240605_0837.py deleted file mode 100644 index 34b2cda99..000000000 --- a/apiserver/plane/db/migrations/0067_auto_20240605_0837.py +++ /dev/null @@ -1,121 +0,0 @@ -# # Generated by Django 4.2.7 on 2024-05-24 09:47 -# Python imports -import uuid -from uuid import uuid4 -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -def issue_estimate_point(apps, schema_editor): - Issue = apps.get_model("db", "Issue") - Project = apps.get_model("db", "Project") - EstimatePoint = apps.get_model("db", "EstimatePoint") - IssueActivity = apps.get_model("db", "IssueActivity") - updated_estimate_point = [] - updated_issue_activity = [] - - # loop through all the projects - for project in Project.objects.filter(estimate__isnull=False): - estimate_points = EstimatePoint.objects.filter( - estimate=project.estimate, project=project - ) - - for issue_activity in IssueActivity.objects.filter( - field="estimate_point", project=project - ): - if issue_activity.new_value: - new_identifier = estimate_points.filter( - key=issue_activity.new_value - ).first().id - issue_activity.new_identifier = new_identifier - new_value = estimate_points.filter( - key=issue_activity.new_value - ).first().value - issue_activity.new_value = new_value - - if issue_activity.old_value: - old_identifier = estimate_points.filter( - key=issue_activity.old_value - ).first().id - issue_activity.old_identifier = old_identifier - old_value = estimate_points.filter( - key=issue_activity.old_value - ).first().value - issue_activity.old_value = old_value - updated_issue_activity.append(issue_activity) - - for issue in Issue.objects.filter( - point__isnull=False, project=project - ): - # get the estimate id for the corresponding estimate point in the issue - estimate = estimate_points.filter(key=issue.point).first() - issue.estimate_point = estimate - updated_estimate_point.append(issue) - - Issue.objects.bulk_update( - updated_estimate_point, ["estimate_point"], batch_size=1000 - ) - IssueActivity.objects.bulk_update( - updated_issue_activity, - ["new_value", "old_value", "new_identifier", "old_identifier"], - batch_size=1000, - ) - - -def last_used_estimate(apps, schema_editor): - Project = apps.get_model("db", "Project") - Estimate = apps.get_model("db", "Estimate") - - # Get all estimate ids used in projects - estimate_ids = Project.objects.filter(estimate__isnull=False).values_list( - "estimate", flat=True - ) - - # Update all matching estimates - Estimate.objects.filter(id__in=estimate_ids).update(last_used=True) - - -class Migration(migrations.Migration): - - dependencies = [ - ("db", "0066_account_id_token_cycle_logo_props_module_logo_props"), - ] - - operations = [ - migrations.AddField( - model_name="estimate", - name="last_used", - field=models.BooleanField(default=False), - ), - # Rename the existing field - migrations.RenameField( - model_name="issue", - old_name="estimate_point", - new_name="point", - ), - # Add a new field with the original name as a foreign key - migrations.AddField( - model_name="issue", - name="estimate_point", - field=models.ForeignKey( - on_delete=django.db.models.deletion.SET_NULL, - related_name="issue_estimates", - to="db.EstimatePoint", - blank=True, - null=True, - ), - ), - migrations.AlterField( - model_name="estimate", - name="type", - field=models.CharField(default="categories", max_length=255), - ), - migrations.AlterField( - model_name="estimatepoint", - name="value", - field=models.CharField(max_length=255), - ), - migrations.RunPython(issue_estimate_point), - migrations.RunPython(last_used_estimate), - ] \ No newline at end of file diff --git a/web/components/estimates/ee-banner.tsx b/web/components/estimates/ee-banner.tsx deleted file mode 100644 index bcd187e0d..000000000 --- a/web/components/estimates/ee-banner.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { FC } from "react"; -import Image from "next/image"; -import { useTheme } from "next-themes"; -import { Crown } from "lucide-react"; -import { Button } from "@plane/ui"; -// public images -import EstimateEmptyDarkImage from "@/public/empty-state/estimates/dark.svg"; -import EstimateEmptyLightImage from "@/public/empty-state/estimates/light.svg"; - -export const EstimateEEBanner: FC = () => { - const { resolvedTheme } = useTheme(); - - const emptyScreenImage = resolvedTheme === "light" ? EstimateEmptyLightImage : EstimateEmptyDarkImage; - - return ( -
-
-
Estimate issues better with points
-
- Use points to estimate scope of work better, monitor capacity, track the burn-down report for your project. -
-
- - - Talk custom pricing - -
-
- -
- Empty estimate image -
-
- ); -}; diff --git a/web/components/estimates/index.ts b/web/components/estimates/index.ts index 4e090232d..e62c4cabb 100644 --- a/web/components/estimates/index.ts +++ b/web/components/estimates/index.ts @@ -2,7 +2,6 @@ export * from "./root"; export * from "./empty-screen"; export * from "./loader-screen"; -export * from "./ee-banner"; export * from "./radio-select"; export * from "./estimate-search"; diff --git a/web/components/estimates/root.tsx b/web/components/estimates/root.tsx index 64102b090..1e5df5492 100644 --- a/web/components/estimates/root.tsx +++ b/web/components/estimates/root.tsx @@ -10,7 +10,6 @@ import { UpdateEstimateModal, DeleteEstimateModal, EstimateList, - EstimateEEBanner, } from "@/components/estimates"; // hooks import { useProject, useProjectEstimates } from "@/hooks/store"; @@ -93,8 +92,6 @@ export const EstimateRoot: FC = observer((props) => { )} - - {/* CRUD modals */}