Fix bug with Period bounds not counting as first value

This commit is contained in:
Gary Graham 2020-02-25 17:03:50 -05:00
parent f56e38148b
commit a1b6e37395
2 changed files with 9 additions and 3 deletions

View File

@ -102,9 +102,11 @@ public class ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchPar
this.myValueHighDateOrdinal = generateOrdinalDateInteger(theHigh); this.myValueHighDateOrdinal = generateOrdinalDateInteger(theHigh);
} }
private int generateOrdinalDateInteger(String theDateString){ private int generateOrdinalDateInteger(String theDateString){
String t = theDateString.substring(0, theDateString.indexOf("T")); if (theDateString.contains("T")) {
t = t.replace("-", ""); theDateString = theDateString.substring(0, theDateString.indexOf("T"));
return Integer.valueOf(t); }
theDateString = theDateString.replace("-", "");
return Integer.valueOf(theDateString);
} }
private void computeValueLowDateOrdinal(String theLow) { private void computeValueLowDateOrdinal(String theLow) {

View File

@ -642,6 +642,10 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
String endString = extractValueAsString(myPeriodEndValueChild, bounds.get()); String endString = extractValueAsString(myPeriodEndValueChild, bounds.get());
dates.add(start); dates.add(start);
dates.add(end); dates.add(end);
//TODO Check if this logic is valid. Does the start of the first period indicate a lower bound??
if (firstValue == null) {
firstValue = extractValueAsString(myPeriodStartValueChild, bounds.get());
}
finalValue = endString; finalValue = endString;
} }
} }