forked from github/plane
fix: currentProjectCompletedCycleIds function updated in store (#3793)
This commit is contained in:
parent
a8c5b558b1
commit
e1ef830f39
@ -1,6 +1,6 @@
|
|||||||
import { action, computed, observable, makeObservable, runInAction } from "mobx";
|
import { action, computed, observable, makeObservable, runInAction } from "mobx";
|
||||||
import { computedFn } from "mobx-utils";
|
import { computedFn } from "mobx-utils";
|
||||||
import { isFuture, isPast } from "date-fns";
|
import { isFuture, isPast, isToday } from "date-fns";
|
||||||
import set from "lodash/set";
|
import set from "lodash/set";
|
||||||
import sortBy from "lodash/sortBy";
|
import sortBy from "lodash/sortBy";
|
||||||
// types
|
// types
|
||||||
@ -118,7 +118,8 @@ export class CycleStore implements ICycleStore {
|
|||||||
if (!projectId || !this.fetchedMap[projectId]) return null;
|
if (!projectId || !this.fetchedMap[projectId]) return null;
|
||||||
let completedCycles = Object.values(this.cycleMap ?? {}).filter((c) => {
|
let completedCycles = Object.values(this.cycleMap ?? {}).filter((c) => {
|
||||||
const hasEndDatePassed = isPast(new Date(c.end_date ?? ""));
|
const hasEndDatePassed = isPast(new Date(c.end_date ?? ""));
|
||||||
return c.project_id === projectId && hasEndDatePassed;
|
const isEndDateToday = isToday(new Date(c.end_date ?? ""));
|
||||||
|
return c.project_id === projectId && hasEndDatePassed && !isEndDateToday;
|
||||||
});
|
});
|
||||||
completedCycles = sortBy(completedCycles, [(c) => c.sort_order]);
|
completedCycles = sortBy(completedCycles, [(c) => c.sort_order]);
|
||||||
const completedCycleIds = completedCycles.map((c) => c.id);
|
const completedCycleIds = completedCycles.map((c) => c.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user