Skip to content

Commit 2ec0a97

Browse files
committed
add search for registration date
only for ngs and disregarding the time as this needs work with client time zones
1 parent f64e0ec commit 2ec0a97

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

datamanager-app/src/main/java/life/qbic/datamanager/views/projects/project/measurements/MeasurementDetailsComponentV2.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ public class MeasurementDetailsComponentV2 extends PageArea implements Serializa
5656
private static final StreamResource ROR_ICON_RESOURCE = new StreamResource("ROR_logo.svg",
5757
() -> MeasurementDetailsComponentV2.class.getClassLoader()
5858
.getResourceAsStream("icons/ROR_logo.svg"));
59-
private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm";
6059
private static final NumberFormat INJECTION_VOLUME_FORMAT = new DecimalFormat("#0.00");
6160
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(
62-
DATE_TIME_FORMAT);
61+
"yyyy-MM-dd HH:mm");
6362

6463
private final AtomicReference<String> clientTimeZone = new AtomicReference<>("UTC");
6564
private final MessageSourceNotificationFactory messageFactory;

project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/experiment/measurement/jpa/NgsMeasurementJpaRepository.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,27 @@ private static Specification<NgsMeasurementInformation> containsSearchTerm(Strin
8686
var measurementNameContains = criteriaBuilder.like(
8787
criteriaBuilder.lower(root.get("measurementName")),
8888
"%" + cleanedLowerCaseSearchTerm + "%");
89+
var registrationDateContains = criteriaBuilder.like(
90+
criteriaBuilder.function("DATE_FORMAT", String.class, root.get("registeredAt"),
91+
criteriaBuilder.literal(
92+
"%Y-%m-%d")), //only search for date not time as problems with time zone
93+
"%" + cleanedLowerCaseSearchTerm + "%");
94+
//sample related matching
8995
Join<Object, String> sampleInfos = root.joinList("sampleInfos");
9096
var sampleCodeContains = criteriaBuilder.like(
9197
criteriaBuilder.lower(sampleInfos.get("sampleCode")),
9298
"%" + cleanedLowerCaseSearchTerm + "%");
9399
var SampleLabelContains = criteriaBuilder.like(
94100
criteriaBuilder.lower(sampleInfos.get("sampleLabel")),
95101
"%" + cleanedLowerCaseSearchTerm + "%");
102+
96103
var sampleCommentContains = criteriaBuilder.like(
97104
criteriaBuilder.lower(sampleInfos.get("comment")),
98105
"%" + cleanedLowerCaseSearchTerm + "%");
99106
return
100107
criteriaBuilder.or(measurementCodeContains,
101108
measurementNameContains,
109+
registrationDateContains,
102110
sampleCodeContains,
103111
SampleLabelContains,
104112
sampleCommentContains);

0 commit comments

Comments
 (0)