Skip to content

Commit

Permalink
[GLT-4271]add deliverable filter (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
wuall826 authored Nov 21, 2024
1 parent 04df44c commit bb61aa1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/add_GLT-4271
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deliverable filter to find cases for a specific deliverable
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ public Function<String, Predicate<Sample>> samplePredicate(MetricCategory reques
return string -> sample -> Objects.equals(sample.getLibraryDesignCode(), string);
}
},
DELIVERABLE(string -> kase -> {
for (CaseDeliverable caseDeliverable : kase.getDeliverables()) {
for (CaseRelease release : caseDeliverable.getReleases()) {
if (string.equalsIgnoreCase(release.getDeliverable())) {
return true;
}
}
}
return false;
}),
STARTED_BEFORE(string -> kase -> kase.getStartDate() != null && kase.getStartDate().isBefore(LocalDate.parse(string))),
STARTED_AFTER(string -> kase -> kase.getStartDate() != null && kase.getStartDate().isAfter(LocalDate.parse(string))),
COMPLETED_BEFORE(string -> kase -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,12 @@ public void testNonPausedCaseFilter() {
17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35));
}

@org.junit.jupiter.api.Test
public void testDeliverableFilter() {
CaseFilter filter = new CaseFilter(CaseFilterKey.DELIVERABLE, "Clinical Report");
testFilterCases(filter, Arrays.asList(25, 26, 27, 29, 30, 31));
}

@org.junit.jupiter.api.Test
public void testStartedBeforeFilter() {
CaseFilter filter = new CaseFilter(CaseFilterKey.STARTED_BEFORE, "2024-01-02");
Expand Down
6 changes: 6 additions & 0 deletions ts/component/table-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ export const caseFilters: FilterDefinition[] = [
values: yesNoOptions,
},
libraryDesignFilter,
{
title: "Deliverable",
key: "DELIVERABLE",
type: "dropdown",
values: siteConfig.deliverables,
},
{
title: "Started After",
key: "STARTED_AFTER",
Expand Down

0 comments on commit bb61aa1

Please sign in to comment.