Skip to content

Commit

Permalink
Addressing reviewer's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-peter committed Mar 3, 2022
1 parent aafa1f2 commit fd18347
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ public class InfluxDbWeatherSource implements WeatherSource {
private static final String COORDINATE_ID_COLUMN_NAME = "coordinate_id";
private static final int MILLI_TO_NANO_FACTOR = 1000000;

/* Final name of the coordinate id field for use in factories */
private final String coordinateIdFieldName;
/* Final name of the column within the database */
private final InfluxDbConnector connector;
private final IdCoordinateSource coordinateSource;
private final TimeBasedWeatherValueFactory weatherValueFactory;
Expand All @@ -54,7 +51,6 @@ public InfluxDbWeatherSource(
this.connector = connector;
this.coordinateSource = coordinateSource;
this.weatherValueFactory = weatherValueFactory;
this.coordinateIdFieldName = weatherValueFactory.getCoordinateIdFieldString();
}

@Override
Expand Down Expand Up @@ -145,14 +141,15 @@ public Optional<TimeBasedValue<WeatherValue>> getWeather(ZonedDateTime date, Poi
}

/**
* Parses an influxQL QueryResult and then transforms them into a Stream of optional
* TimeBasedValue&lt;WeatherValue&gt;, with a present Optional value, if the transformation was
* successful and an empty optional otherwise.
* Parses an influxQL QueryResult and then transforms it into a Stream of optional
* TimeBasedValue&lt;WeatherValue&gt;, with a present Optional value if the transformation was
* successful and an empty Optional otherwise.
*/
private Stream<Optional<TimeBasedValue<WeatherValue>>> optTimeBasedValueStream(
QueryResult queryResult) {
Map<String, Set<Map<String, String>>> measurementsMap =
InfluxDbConnector.parseQueryResult(queryResult, MEASUREMENT_NAME_WEATHER);
final String coordinateIdFieldName = weatherValueFactory.getCoordinateIdFieldString();
return measurementsMap.get(MEASUREMENT_NAME_WEATHER).stream()
.map(
fieldToValue -> {
Expand Down

0 comments on commit fd18347

Please sign in to comment.