chore: removed migration file and updated the estimate system order and removed ee banner

This commit is contained in:
guru_sainath 2024-06-06 12:55:27 +05:30
parent 2da91383d4
commit ae9f1a7a94
5 changed files with 35 additions and 207 deletions

View File

@ -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),
]

View File

@ -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 (
<div className="rounded overflow-hidden relative flex items-center mt-10 bg-[linear-gradient(270deg,_#3B5DC5_1.71%,_rgba(44,66,131,0)_111.71%)]">
<div className="w-full p-10 space-y-2">
<div className="text-xl font-semibold">Estimate issues better with points</div>
<div className="text-base text-custom-text-200">
Use points to estimate scope of work better, monitor capacity, track the burn-down report for your project.
</div>
<div className="relative flex items-center gap-4 pt-4">
<Button prependIcon={<Crown size={12} className="text-amber-400" />} variant="primary" size="sm">
Upgrade
</Button>
<a
href={"#"}
target="_blank"
className="text-base text-custom-primary-100/80 hover:text-custom-primary-100 underline underline-offset-4 transition-colors"
>
Talk custom pricing
</a>
</div>
</div>
<div className="hidden lg:block h-[260px]">
<Image
src={emptyScreenImage}
alt="Empty estimate image"
width={100}
height={100}
className="object-contain w-full h-full"
/>
</div>
</div>
);
};

View File

@ -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";

View File

@ -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<TEstimateRoot> = observer((props) => {
</div>
)}
<EstimateEEBanner />
{/* CRUD modals */}
<CreateEstimateModal
workspaceSlug={workspaceSlug}

View File

@ -16,41 +16,6 @@ export enum EEstimateUpdateStages {
export const maxEstimatesCount = 11;
export const ESTIMATE_SYSTEMS: TEstimateSystems = {
categories: {
name: "Categories",
templates: {
t_shirt_sizes: {
title: "T-Shirt Sizes",
values: [
{ id: undefined, key: 1, value: "XS" },
{ id: undefined, key: 2, value: "S" },
{ id: undefined, key: 3, value: "M" },
{ id: undefined, key: 4, value: "L" },
{ id: undefined, key: 5, value: "XL" },
{ id: undefined, key: 6, value: "XXL" },
],
},
easy_to_hard: {
title: "Easy to hard",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Medium" },
{ id: undefined, key: 3, value: "Hard" },
{ id: undefined, key: 4, value: "Very Hard" },
],
},
custom: {
title: "Custom",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Hard" },
],
hide: true,
},
},
is_available: true,
is_ee: false,
},
points: {
name: "Points",
templates: {
@ -104,6 +69,41 @@ export const ESTIMATE_SYSTEMS: TEstimateSystems = {
is_available: true,
is_ee: false,
},
categories: {
name: "Categories",
templates: {
t_shirt_sizes: {
title: "T-Shirt Sizes",
values: [
{ id: undefined, key: 1, value: "XS" },
{ id: undefined, key: 2, value: "S" },
{ id: undefined, key: 3, value: "M" },
{ id: undefined, key: 4, value: "L" },
{ id: undefined, key: 5, value: "XL" },
{ id: undefined, key: 6, value: "XXL" },
],
},
easy_to_hard: {
title: "Easy to hard",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Medium" },
{ id: undefined, key: 3, value: "Hard" },
{ id: undefined, key: 4, value: "Very Hard" },
],
},
custom: {
title: "Custom",
values: [
{ id: undefined, key: 1, value: "Easy" },
{ id: undefined, key: 2, value: "Hard" },
],
hide: true,
},
},
is_available: true,
is_ee: false,
},
time: {
name: "Time",
templates: {