Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix timestamp format in ratio/groupBy/boundary endpoint #319

Merged
merged 1 commit into from
Nov 24, 2023
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Changelog

## 1.11.0-SNAPSHOT (current master)

### Bug Fixes
* Fix inconsistent timestamp format in `/elements/(aggregation)/ratio/groupBy/boundary` request responses ([#318])

[#318]: https://github.com/GIScience/ohsome-api/issues/318


## 1.10.1

* Fix performance degradation in previous release (version 1.10.0) which made data extractions very slow for medium to large query areas ([oshdb#516])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,10 @@ public static <P extends Geometry & Polygonal> Response aggregateBasicFiltersRat
resultValues2[matchesBothCount] = resultValues2[matchesBothCount]
+ Double.parseDouble(df.format(innerEntry.getValue().doubleValue()));
if (!timeArrayFilled) {
String time = innerEntry.getKey().getFirstIndex().toString();
String time = TimestampFormatter.getInstance().isoDateTime(
innerEntry.getKey().getFirstIndex());
if (matchesBothCount == 0 || !timeArray[timeArrayCount - 1].equals(time)) {
timeArray[timeArrayCount] = innerEntry.getKey().getFirstIndex().toString();
timeArray[timeArrayCount] = time;
timeArrayCount++;
}
}
Expand Down Expand Up @@ -1083,9 +1084,10 @@ public static <P extends Geometry & Polygonal> Response aggregateRatioGroupByBou
resultValues2[matchesBothCount] = resultValues2[matchesBothCount]
+ Double.parseDouble(df.format(innerEntry.getValue().doubleValue()));
if (!timeArrayFilled) {
String time = innerEntry.getKey().getFirstIndex().toString();
String time = TimestampFormatter.getInstance().isoDateTime(
innerEntry.getKey().getFirstIndex());
if (matchesBothCount == 0 || !timeArray[timeArrayCount - 1].equals(time)) {
timeArray[timeArrayCount] = innerEntry.getKey().getFirstIndex().toString();
timeArray[timeArrayCount] = time;
timeArrayCount++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ public void elementsAreaRatioGroupByBoundaryTest() {
server + port + "/elements/area/ratio/groupBy/boundary", map, JsonNode.class);
assertEquals(expectedValue, response.getBody().get("groupByBoundaryResult").get(1)
.get("ratioResult").get(0).get("ratio").asDouble(), expectedValue * deltaPercentage);
assertEquals("2017-01-01T00:00:00Z", response.getBody().get("groupByBoundaryResult").get(1)
.get("ratioResult").get(0).get("timestamp").asText());
}

@Test
Expand Down