Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/api/plane/utils/filters/filterset.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class Meta:
"target_date": ["exact", "range"],
"created_at": ["exact", "range"],
"updated_at": ["exact", "range"],
"completed_at": ["exact", "range"],
"is_draft": ["exact"],
"priority": ["exact", "in"],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import type {
import { Avatar } from "@plane/ui";
import {
getAssigneeFilterConfig,
getCompletedAtFilterConfig,
getCreatedAtFilterConfig,
getCreatedByFilterConfig,
getCycleFilterConfig,
Expand Down Expand Up @@ -349,6 +350,17 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
[operatorConfigs]
);

// completed at filter config
const completedAtFilterConfig = useMemo(
() =>
getCompletedAtFilterConfig<TWorkItemFilterProperty>("completed_at")({
isEnabled: true,
filterIcon: CalendarLayoutIcon,
...operatorConfigs,
}),
[operatorConfigs]
);

// project filter config
const projectFilterConfig = useMemo(
() =>
Expand Down Expand Up @@ -378,6 +390,7 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
targetDateFilterConfig,
createdAtFilterConfig,
updatedAtFilterConfig,
completedAtFilterConfig,
createdByFilterConfig,
subscriberFilterConfig,
],
Expand All @@ -397,6 +410,7 @@ export const useWorkItemFiltersConfig = (props: TUseWorkItemFiltersConfigProps):
target_date: targetDateFilterConfig,
created_at: createdAtFilterConfig,
updated_at: updatedAtFilterConfig,
completed_at: completedAtFilterConfig,
},
isFilterEnabled,
members: members ?? [],
Expand Down
6 changes: 3 additions & 3 deletions apps/web/core/store/issue/helpers/base-issues-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export const getIssueIds = (issues: TIssue[]) => issues.map((issue) => issue?.id
/**
* Checks if an issue meets the date filter criteria
* @param issue The issue to check
* @param filterKey The date field to check ('start_date' or 'target_date')
* @param filterKey The date field to check ('start_date', 'target_date', or 'completed_at')
* @param dateFilters Array of date filter strings
* @returns boolean indicating if the issue meets the date criteria
*/
export const checkIssueDateFilter = (
issue: TIssue,
filterKey: "start_date" | "target_date",
filterKey: "start_date" | "target_date" | "completed_at",
dateFilters: string[]
): boolean => {
if (!dateFilters || dateFilters.length === 0) return true;
Expand Down Expand Up @@ -254,7 +254,7 @@ export const getFilteredWorkItems = (workItems: TIssue[], filters: IIssueFilterO
// Check all filter conditions (AND operation between different filters)
activeFilters.every(([filterKey, filterValues]) => {
// Handle date filters separately
if (filterKey === "start_date" || filterKey === "target_date") {
if (filterKey === "start_date" || filterKey === "target_date" || filterKey === "completed_at") {
return checkIssueDateFilter(workItem, filterKey, filterValues as string[]);
}
Comment thread
muhammadusman586 marked this conversation as resolved.
// Handle regular filters
Expand Down
5 changes: 4 additions & 1 deletion packages/constants/src/issue/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export type TIssueFiltersToDisplayByPageType = {

export const ISSUE_DISPLAY_FILTERS_BY_PAGE: TIssueFiltersToDisplayByPageType = {
profile_issues: {
filters: ["priority", "state_group", "label_id", "start_date", "target_date"],
filters: ["priority", "state_group", "label_id", "start_date", "target_date", "completed_at"],
layoutOptions: {
list: {
display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS,
Expand Down Expand Up @@ -151,6 +151,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_PAGE: TIssueFiltersToDisplayByPageType = {
"label_id",
"start_date",
"target_date",
"completed_at",
],
layoutOptions: {
list: {
Expand Down Expand Up @@ -178,6 +179,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_PAGE: TIssueFiltersToDisplayByPageType = {
"project_id",
"start_date",
"target_date",
"completed_at",
],
layoutOptions: {
spreadsheet: {
Expand Down Expand Up @@ -216,6 +218,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_PAGE: TIssueFiltersToDisplayByPageType = {
"label_id",
"start_date",
"target_date",
"completed_at",
],
layoutOptions: {
list: {
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/view-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const WORK_ITEM_FILTER_PROPERTY_KEYS = [
"project_id",
"created_at",
"updated_at",
"completed_at",
] as const;
export type TWorkItemFilterProperty = (typeof WORK_ITEM_FILTER_PROPERTY_KEYS)[number];

Expand Down Expand Up @@ -143,6 +144,7 @@ export interface IIssueFilterOptions {
state_group?: string[] | null;
subscriber?: string[] | null;
target_date?: string[] | null;
completed_at?: string[] | null;
issue_type?: string[] | null;
}

Expand Down
18 changes: 18 additions & 0 deletions packages/utils/src/work-item-filters/configs/filters/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,21 @@ export const getUpdatedAtFilterConfig =
allowMultipleFilters: true,
supportedOperatorConfigsMap: getSupportedDateOperators(params),
});

/**
* Get the completed at filter config
* @template K - The filter key
* @param key - The filter key to use
* @returns A function that takes parameters and returns the completed at filter config
*/
export const getCompletedAtFilterConfig =
<P extends TFilterProperty>(key: P): TCreateFilterConfig<P, TCreateDateFilterParams> =>
(params: TCreateDateFilterParams) =>
createFilterConfig<P>({
id: key,
label: "Completed at",
...params,
icon: params.filterIcon,
allowMultipleFilters: true,
supportedOperatorConfigsMap: getSupportedDateOperators(params),
});