class PatchingServiceImpl implements PatchingService, Constants {

    @Override
    public Map<String, Object> getPatchingProgress(String assetGroup, int year,
            int quarter) throws ServiceException {
        List<Map<String, Object>> patchingProgressList;
        try {
            patchingProgressList = repository.getPatchingProgress(assetGroup,
                    getFirstDayOfQuarter(quarter, year),
                    getLastDayOfQuarter(quarter, year));

            // Sort the list by the date in ascending order
            Comparator<Map<String, Object>> comp = (m1, m2) -> LocalDate.parse(
                    m1.get("date").toString(), DateTimeFormatter.ISO_DATE)
                    .compareTo(
                            LocalDate.parse(m2.get("date").toString(),
                                    DateTimeFormatter.ISO_DATE));
            Collections.sort(patchingProgressList, comp);
            // Elastic Search might not have data for some dates. But we want to
            // send consistent data to the consumers of this service, so we will
            // populate zeros where data is unavailable
            fillNoDataDatesWithPrevious(patchingProgressList, year, quarter);
            issueTrendService.useRealTimeDataForLatestDate(
                    patchingProgressList, assetGroup, "patching", null, null);
        } catch (DataException e) {
            throw new ServiceException(e);
        }
        return segregatePatchingProgressByWeek(assetGroup,
                patchingProgressList, year, quarter);

    }

}