Skip to content

Commit

Permalink
fix: currentProjectCompletedCycleIds function updated in store (#3793)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia authored Feb 26, 2024
1 parent a8c5b55 commit e1ef830
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/store/cycle.store.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action, computed, observable, makeObservable, runInAction } from "mobx";
import { computedFn } from "mobx-utils";
import { isFuture, isPast } from "date-fns";
import { isFuture, isPast, isToday } from "date-fns";
import set from "lodash/set";
import sortBy from "lodash/sortBy";
// types
Expand Down Expand Up @@ -118,7 +118,8 @@ export class CycleStore implements ICycleStore {
if (!projectId || !this.fetchedMap[projectId]) return null;
let completedCycles = Object.values(this.cycleMap ?? {}).filter((c) => {
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]);
const completedCycleIds = completedCycles.map((c) => c.id);
Expand Down

0 comments on commit e1ef830

Please sign in to comment.