mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 14:01:45 +02:00
[WEB-2595] fix: cycle update issue + ticks (#2595)
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
@@ -489,16 +489,13 @@ export class CycleStore implements ICycleStore {
|
||||
* @param cycleId
|
||||
* @returns
|
||||
*/
|
||||
fetchActiveCycleProgress = async (workspaceSlug: string, projectId: string, cycleId: string) => {
|
||||
this.progressLoader = true;
|
||||
return await this.cycleService.workspaceActiveCyclesProgress(workspaceSlug, projectId, cycleId).then((progress) => {
|
||||
fetchActiveCycleProgress = async (workspaceSlug: string, projectId: string, cycleId: string) =>
|
||||
await this.cycleService.workspaceActiveCyclesProgress(workspaceSlug, projectId, cycleId).then((progress) => {
|
||||
runInAction(() => {
|
||||
set(this.cycleMap, [cycleId], { ...this.cycleMap[cycleId], ...progress });
|
||||
this.progressLoader = false;
|
||||
});
|
||||
return progress;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @description fetches active cycle progress for pro users
|
||||
@@ -522,8 +519,9 @@ export class CycleStore implements ICycleStore {
|
||||
projectId: string,
|
||||
cycleId: string,
|
||||
analytic_type: string
|
||||
) =>
|
||||
await this.cycleService
|
||||
) => {
|
||||
set(this.cycleMap, [cycleId, analytic_type === "points" ? "estimate_distribution" : "distribution"], null);
|
||||
return await this.cycleService
|
||||
.workspaceActiveCyclesAnalytics(workspaceSlug, projectId, cycleId, analytic_type)
|
||||
.then((cycle) => {
|
||||
runInAction(() => {
|
||||
@@ -531,7 +529,7 @@ export class CycleStore implements ICycleStore {
|
||||
});
|
||||
return cycle;
|
||||
});
|
||||
|
||||
};
|
||||
/**
|
||||
* @description fetches cycle details
|
||||
* @param workspaceSlug
|
||||
@@ -608,9 +606,6 @@ export class CycleStore implements ICycleStore {
|
||||
*/
|
||||
updateCycleDetails = async (workspaceSlug: string, projectId: string, cycleId: string, data: Partial<ICycle>) => {
|
||||
try {
|
||||
runInAction(() => {
|
||||
set(this.cycleMap, [cycleId], { ...this.cycleMap?.[cycleId], ...data });
|
||||
});
|
||||
const response = await this.cycleService.patchCycle(workspaceSlug, projectId, cycleId, data);
|
||||
this.fetchCycleDetails(workspaceSlug, projectId, cycleId);
|
||||
return response;
|
||||
|
||||
@@ -50,7 +50,6 @@ export const ActiveCycleBase: React.FC<IActiveCycleDetails> = observer((props) =
|
||||
projectId={projectId}
|
||||
cycleId={cycleDetails.cycle?.id || " "}
|
||||
workspaceSlug={workspaceSlug}
|
||||
progressLoader={cycleDetails.progressLoader}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { startOfToday, format } from "date-fns";
|
||||
import { startOfToday, format, differenceInWeeks } from "date-fns";
|
||||
import { TCycleProgress } from "@plane/types";
|
||||
import { TProgressChartData } from "@/helpers/cycle.helper";
|
||||
|
||||
@@ -33,6 +33,7 @@ const CustomizedXAxisTicks = (props: TProps) => {
|
||||
const isStart = payload.value === startDate;
|
||||
const isEnd = payload.value === endDate;
|
||||
const isToday = payload.value === format(startOfToday(), "yyyy-MM-dd");
|
||||
const weeks = endDate && startDate ? differenceInWeeks(endDate, startDate) : 4;
|
||||
|
||||
if (!data || !endDate) return null;
|
||||
|
||||
@@ -62,7 +63,10 @@ const CustomizedXAxisTicks = (props: TProps) => {
|
||||
|
||||
const shouldShowThisTick = () =>
|
||||
(data.length < 10 && showAllTicks) ||
|
||||
(payload.index !== 0 && payload.index % 7 === 0 && !areAdjacentTicksVisible(payload) && showAllTicks) ||
|
||||
(payload.index !== 0 &&
|
||||
payload.index % (weeks * 2 - 1) === 0 &&
|
||||
!areAdjacentTicksVisible(payload) &&
|
||||
showAllTicks) ||
|
||||
shouldShowTick(data[payload.index]);
|
||||
|
||||
if (!shouldShowThisTick()) return null;
|
||||
|
||||
@@ -86,7 +86,7 @@ const ActiveCycleDetail = observer((props: ActiveCycleDetailProps) => {
|
||||
})}
|
||||
>
|
||||
<div className="h-full w-full flex-1">
|
||||
{cycleProgress !== null ? (
|
||||
{cycleProgress !== null && !progressLoader ? (
|
||||
<div className="h-[430px]">
|
||||
<Selection
|
||||
plotType={computedPlotType}
|
||||
@@ -119,7 +119,6 @@ const ActiveCycleDetail = observer((props: ActiveCycleDetailProps) => {
|
||||
data={cycleProgress}
|
||||
estimateType={computedEstimateType}
|
||||
plotType={computedPlotType}
|
||||
progressLoader={progressLoader}
|
||||
handleFiltersUpdate={handleFiltersUpdate}
|
||||
parentWidth={containerWidth}
|
||||
/>
|
||||
|
||||
@@ -22,7 +22,8 @@ const formatV1Data = (isTypeIssue: boolean, cycle: ICycle, isBurnDown: boolean,
|
||||
const pending = data.completion_chart[p] || 0;
|
||||
const total = (isTypeIssue ? cycle.total_issues : cycle.total_estimate_points) || 0;
|
||||
const completed = total - pending;
|
||||
const idealDone = ideal(p, total, cycle);
|
||||
const idealDone = ideal(p, total, cycle) || 0;
|
||||
|
||||
return {
|
||||
date: p,
|
||||
scope: p! <= cycle.end_date! ? total : null,
|
||||
|
||||
@@ -18,7 +18,6 @@ type Props = {
|
||||
projectId: string;
|
||||
cycleId: string;
|
||||
cycleDetails: ICycle;
|
||||
progressLoader: boolean;
|
||||
};
|
||||
|
||||
export const CycleProgressHeader: FC<Props> = (props: Props) => {
|
||||
|
||||
@@ -15,7 +15,6 @@ type Props = {
|
||||
data: Partial<TCycleProgress>[] | null;
|
||||
plotType: string;
|
||||
estimateType: string;
|
||||
progressLoader?: boolean;
|
||||
handleFiltersUpdate: (key: keyof IIssueFilterOptions, value: string[], redirect?: boolean) => void;
|
||||
parentWidth?: number;
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ const useCycleDetails = (props: IActiveCycleDetails) => {
|
||||
// fetches cycle details for non-pro users
|
||||
useSWR(
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS`
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_${cycle.start_date}_${cycle.end_date}`
|
||||
: null,
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? () => fetchActiveCycleProgress(workspaceSlug, projectId, cycle.id)
|
||||
@@ -56,26 +56,28 @@ const useCycleDetails = (props: IActiveCycleDetails) => {
|
||||
);
|
||||
// fetches cycle details for non-pro users
|
||||
useSWR(
|
||||
workspaceSlug && projectId && cycle?.id && !cycle?.distribution && cycle?.version === 1
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_DURATION`
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_DURATION_${cycle.start_date}_${cycle.end_date}`
|
||||
: null,
|
||||
workspaceSlug && projectId && cycle?.id && !cycle?.distribution && cycle?.version === 1
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? () => fetchActiveCycleAnalytics(workspaceSlug, projectId, cycle.id, "issues")
|
||||
: null
|
||||
: null,
|
||||
{ revalidateIfStale: false, revalidateOnFocus: false }
|
||||
);
|
||||
// fetches cycle details for non-pro users
|
||||
useSWR(
|
||||
workspaceSlug && projectId && cycle?.id && !cycle?.estimate_distribution && cycle?.version === 1
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_ESTIMATE_DURATION`
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_ESTIMATE_DURATION_${cycle.start_date}_${cycle.end_date}`
|
||||
: null,
|
||||
workspaceSlug && projectId && cycle?.id && !cycle?.estimate_distribution && cycle?.version === 1
|
||||
workspaceSlug && projectId && cycle?.id && cycle?.version === 1
|
||||
? () => fetchActiveCycleAnalytics(workspaceSlug, projectId, cycle.id, "points")
|
||||
: null
|
||||
: null,
|
||||
{ revalidateIfStale: false, revalidateOnFocus: false }
|
||||
);
|
||||
// fetches cycle details for pro users
|
||||
useSWR(
|
||||
workspaceSlug && projectId && cycleId && cycle?.version === 2
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_PRO`
|
||||
? `PROJECT_ACTIVE_CYCLE_${projectId}_PROGRESS_PRO_${cycle.start_date}_${cycle.end_date}`
|
||||
: null,
|
||||
workspaceSlug && projectId && cycleId && cycle?.version === 2
|
||||
? () => fetchActiveCycleProgressPro(workspaceSlug, projectId, cycleId)
|
||||
|
||||
@@ -14190,4 +14190,4 @@ zod@^3.22.2, zod@^3.23.8, zod@^3.24.1:
|
||||
zxcvbn@^4.4.2:
|
||||
version "4.4.2"
|
||||
resolved "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz#28ec17cf09743edcab056ddd8b1b06262cc73c30"
|
||||
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
|
||||
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
|
||||
Reference in New Issue
Block a user