1
0
mirror of https://github.com/Qortal/qortal.git synced 2025-07-25 03:01:22 +00:00

implemented before and after filtering

This commit is contained in:
kennycud
2025-03-13 13:46:17 -07:00
parent dbf49309ec
commit e76694e214
2 changed files with 34 additions and 0 deletions
src
main
java
org
qortal
repository
test
java
org
qortal

@@ -183,6 +183,14 @@ public class HSQLDBCacheUtils {
// retain only candidates with names
Stream<ArbitraryResourceData> stream = candidates.stream().filter(candidate -> candidate.name != null );
if(after.isPresent()) {
stream = stream.filter( candidate -> candidate.created > after.get().longValue() );
}
if(before.isPresent()) {
stream = stream.filter( candidate -> candidate.created < before.get().longValue() );
}
if(exclude.isPresent())
stream = stream.filter( candidate -> !exclude.get().get().contains( candidate.name ));

@@ -300,6 +300,19 @@ public class HSQLDBCacheUtilsTests {
);
}
@Test
public void testAfterNegative() {
ArbitraryResourceData data = new ArbitraryResourceData();
data.created = 10L;
data.name = "Joe";
filterListByMap(
List.of(data),
NAME_LEVEL, new HashMap<>(Map.of(AFTER, 11L)),
0
);
}
@Test
public void testBeforePositive(){
ArbitraryResourceData data = new ArbitraryResourceData();
@@ -313,6 +326,19 @@ public class HSQLDBCacheUtilsTests {
);
}
@Test
public void testBeforeNegative(){
ArbitraryResourceData data = new ArbitraryResourceData();
data.created = 10L;
data.name = "Joe";
filterListByMap(
List.of(data),
NAME_LEVEL, new HashMap<>(Map.of(BEFORE, 9L)),
0
);
}
@Test
public void testTitlePositive() {