Source:
<code>private Optional<AggStats> computeAggStatsForDay(final Long accountId, final DeviceId deviceId, final DateTime targetDateLocal, final Integer timeZoneOffset) { final DateTime startLocalTime = targetDateLocal.withHourOfDay(AggStats.DAY_START_END_HOUR); final DateTime endLocalTime = targetDateLocal.plusDays(1).withHourOfDay(AggStats.DAY_START_END_HOUR); final DateTime startUTCTime = startLocalTime.minusMillis(timeZoneOffset); final DateTime endUTCTime = endLocalTime.minusMillis(timeZoneOffset); final Response<ImmutableList<DeviceData>> deviceDataListResponse = deviceDataDAODynamoDB.getBetweenLocalTime(accountId, deviceId, startUTCTime, endUTCTime, startLocalTime, endLocalTime, deviceDataDAODynamoDB.ALL_ATTRIBUTES); LOGGER.trace("processor=agg-stats action=queryed-device-data account_id={} targetDateLocal={} status={} len_data={}", accountId, targetDateLocal.toString(), deviceDataListResponse.status.toString(), deviceDataListResponse.data.size()); <START> if (deviceDataListResponse.data.size() == 0) { <END> LOGGER.trace("processor=agg-stats action=do nothing reason=empty-device-data account_id={} targetDateLocal={}", accountId, targetDateLocal.toString()); return Optional.absent(); } final ImmutableList<TrackerMotion> pillDataList = pillDataDAODynamoDB.getBetweenLocalUTC(accountId, startLocalTime, endLocalTime); LOGGER.trace("processor=agg-stats action=queryed-tracker-motion account_id={} targetDateLocal={} len_data={}", accountId, targetDateLocal.toString(), pillDataList.size()); final Optional<Device.Color> senseColorOptional = getSenseColorOptional(senseColorDAO, deviceId); final Optional<Calibration> calibrationOptional = getCalibrationOptional(calibrationDAO, deviceId); final AggStatsInputs aggStatsInputs = AggStatsInputs.create(senseColorOptional, calibrationOptional, deviceDataListResponse, pillDataList); final AggStats aggStats = AggStatsComputer.computeAggStats(accountId, deviceId, targetDateLocal, aggStatsInputs); return Optional.of(aggStats); }</code><technical_language>prefer deviceDataListResponse.data.isEmpty()</technical_language>

Target:
private Optional<AggStats> computeAggStatsForDay(final Long accountId, final DeviceId deviceId, final DateTime targetDateLocal, final Integer timeZoneOffset) { final DateTime startLocalTime = targetDateLocal.withHourOfDay(AggStats.DAY_START_END_HOUR); final DateTime endLocalTime = targetDateLocal.plusDays(1).withHourOfDay(AggStats.DAY_START_END_HOUR); final DateTime startUTCTime = startLocalTime.minusMillis(timeZoneOffset); final DateTime endUTCTime = endLocalTime.minusMillis(timeZoneOffset); final Response<ImmutableList<DeviceData>> deviceDataListResponse = deviceDataDAODynamoDB.getBetweenLocalTime(accountId, deviceId, startUTCTime, endUTCTime, startLocalTime, endLocalTime, deviceDataDAODynamoDB.ALL_ATTRIBUTES); LOGGER.trace("processor=agg-stats action=queryed-device-data account_id={} targetDateLocal={} status={} len_data={}", accountId, targetDateLocal.toString(), deviceDataListResponse.status.toString(), deviceDataListResponse.data.size()); final ImmutableList<TrackerMotion> pillDataList = pillDataDAODynamoDB.getBetweenLocalUTC(accountId, startLocalTime, endLocalTime); LOGGER.trace("processor=agg-stats action=queryed-tracker-motion account_id={} targetDateLocal={} len_data={}", accountId, targetDateLocal.toString(), pillDataList.size()); final Optional<Device.Color> senseColorOptional = getSenseColorOptional(senseColorDAO, deviceId); final Optional<Calibration> calibrationOptional = getCalibrationOptional(calibrationDAO, deviceId); final AggStatsInputs aggStatsInputs = AggStatsInputs.create(senseColorOptional, calibrationOptional, deviceDataListResponse, pillDataList); final Optional<AggStats> aggStats = AggStatsComputer.computeAggStats(accountId, deviceId, targetDateLocal, aggStatsInputs); return aggStats; }