backend/src/main/java/ch/fhnw/speech_collection_app/features/base/admin/statistics/StatisticsService.java
private SeriesDto toSeriesDto(SelectConditionStep<Record2<Date, Integer>> select, String checked_texts, LocalDate since, Field<Date> date) {
        var sinceDate = since.atStartOfDay();
        var allDates = sinceDate.toLocalDate().datesUntil(LocalDate.now().plusDays(1))
                .collect(Collectors.toMap(localDate -> localDate, o -> 0));
        var datesWithData = select.groupBy(date)
                .fetch()
                .stream()
                .filter(r -> r.component1() != null)
                .collect(Collectors.toMap(r -> r.component1().toLocalDate(), Record2::component2));
        allDates.putAll(datesWithData);
        var res = allDates.entrySet().stream().map(r -> new SeriesValueDto(r.getKey(), r.getValue())).collect(Collectors.toList());
        return new SeriesDto(checked_texts, res);
    }
/**
     * fetches the query from the database and returns it ready to be displayed by the frontend.
     *
     * @implNote this implementation only makes sense for relatively small queries as else a lot of dates have to be filled with zeroes.
     */
fetches the query from the database and returns it ready to be displayed by the frontend.
@implNote this implementation only makes sense for relatively small queries as else a lot of dates have to be filled with zeroes.
fetches the query from the database and returns it ready to be displayed by the frontend . @implNote this implementation only makes sense for relatively small queries as else a lot of dates have to be filled with zeroes .
private SeriesDto toSeriesDto(SelectConditionStep<Record2<Date, Integer>> select, String checked_texts, LocalDate since, Field<Date> date) {
        var sinceDate = since.atStartOfDay();
        var allDates = sinceDate.toLocalDate().datesUntil(LocalDate.now().plusDays(1))
                .collect(Collectors.toMap(localDate -> localDate, o -> 0));
        var datesWithData = select.groupBy(date)
                .fetch()
                .stream()
                .filter(r -> r.component1() != null)
                .collect(Collectors.toMap(r -> r.component1().toLocalDate(), Record2::component2));
        allDates.putAll(datesWithData);
        var res = allDates.entrySet().stream().map(r -> new SeriesValueDto(r.getKey(), r.getValue())).collect(Collectors.toList());
        return new SeriesDto(checked_texts, res);
    }
private SeriesDto toSeriesDto ( SelectConditionStep < Record2 < Date , Integer > > select , String checked_texts , LocalDate since , Field < Date > date ) { var sinceDate = since . atStartOfDay ( ) ; var allDates = sinceDate . toLocalDate ( ) . datesUntil ( LocalDate . now ( ) . plusDays ( 1 ) ) . collect ( Collectors . toMap ( localDate -> localDate , o -> 0 ) ) ; var datesWithData = select . groupBy ( date ) . fetch ( ) . stream ( ) . filter ( r -> r . component1 ( ) != null ) . collect ( Collectors . toMap ( r -> r . component1 ( ) . toLocalDate ( ) , Record2 :: component2 ) ) ; allDates . putAll ( datesWithData ) ; var res = allDates . entrySet ( ) . stream ( ) . map ( r -> new SeriesValueDto ( r . getKey ( ) , r . getValue ( ) ) ) . collect ( Collectors . toList ( ) ) ; return new SeriesDto ( checked_texts , res ) ; }
fetches the query from the database and returns it ready to be displayed by the frontend.
fetches the query from the database and returns it ready to be displayed by the frontend .