Skip to content

Feature/ab#2146 correct ganglinien and table for time period#20

Merged
witchpou merged 6 commits intosprintfrom
feature/ab#2146-correct-ganglinien-and-table-for-time-period
Mar 18, 2026
Merged

Feature/ab#2146 correct ganglinien and table for time period#20
witchpou merged 6 commits intosprintfrom
feature/ab#2146-correct-ganglinien-and-table-for-time-period

Conversation

@witchpou
Copy link

Description

If time range is selected, weekday averadge should be shown.

Issue References

Definition of Done

  • Acceptance criteria are met
  • Testing is done (unit-tests, DEV-environment)
  • Build/Test workflow has successfully finished
  • Release notes are complemented
  • Documentation is complemented (operator manual, system specification, etc.)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for calculating and loading “Wochentagsdurchschnitt” (weekday average) time-interval data for Dauerzählungen when the frontend selects a Zeitraum-based time selection, plus a few logging/doc/test-context adjustments.

Changes:

  • Extend LadeZaehldatenService with a weekday-average extraction path for Dauerzählungen + Zeitraum selection.
  • Introduce a native-query-based repository method and entity result mapping to fetch weekday averages from zeitintervall.
  • Reduce debug logging noise and add a developer doc with SQL scratch queries; adjust Spring test wiring to satisfy new bean dependencies.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/test/java/de/muenchen/dave/domain/mapper/StadtbezirkMapperTest.java Adds additional mocked beans to keep the Spring test context bootstrappable with new dependencies.
src/main/java/de/muenchen/dave/services/persist/ZeitintervallPersistierungsService.java Comments out a debug logging loop in aufbereitenForZeitraum.
src/main/java/de/muenchen/dave/services/ladezaehldaten/LadeZaehldatenService.java Adds a new extraction branch + helper method to load weekday averages for Dauerzählungen over a Zeitraum.
src/main/java/de/muenchen/dave/repositories/relationaldb/ZeitintervallRepository.java Adds a repository method intended to execute a native query for weekday averages.
src/main/java/de/muenchen/dave/domain/Zeitintervall.java Adds @NamedNativeQuery + @SqlResultSetMapping and a constructor for mapping weekday-average results.
src/main/java/de/muenchen/dave/controller/LadeZaehldatenController.java Removes debug logging of the full processed payload.
docs/development.md Adds development hints containing SQL statements used to derive the weekday-average query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +74 to +81
@Query(nativeQuery = true)
List<Zeitintervall> findWeekdayAverageByZaehlungIdOrderBySortingIndexAsc(
final String zaehlungId,
final LocalDateTime start,
final LocalDateTime ende,
final List<Integer> vonKnotenarm,
final List<Integer> nachKnotenarm,
final List<Integer> tagestyp);
List<Integer> vonKnotenarm = IntStream.rangeClosed(1, 8).boxed().toList();
List<Integer> nachKnotenarm = IntStream.rangeClosed(1, 8).boxed().toList();

if (options.getBeideRichtungen()) {
ladeZaehldaten = zeitintervalle.stream()
.map(zeitintervall -> mapToZaehldatum(zeitintervall, pkwEinheit, options))
.collect(Collectors.toList());
//ladeZaehldaten = extractZeitintervalleWochentagsdurchschnitt(zaehlungId, options, pkwEinheit);
Comment on lines +40 to +50
"\tround(sum(pkw)/count(startuhrzeit::time)) as pkw, \n" + //
"\tround(sum(lkw)/count(startuhrzeit::time)) as lkw,\n" + //
"\tround(sum (lastzuege)/count(startuhrzeit::time)) as lastzuege,\n" + //
"\tround(sum(busse)/count(startuhrzeit::time)) as busse,\n" + //
"\tround(sum(kraftraeder)/count(startuhrzeit::time)) as kraftraeder,\n" + //
"\tround(sum(fahrradfahrer)/count(startuhrzeit::time)) as fahrradfahrer,\n" + //
"\tround(sum(fussgaenger)/count(startuhrzeit::time)) as fussgaenger, \n" + //
"\tround(sum(hochrechnung_hochrechnungkfz)/count(startuhrzeit::time),2) as hochrechnungkfz,\n" + //
"\tround(sum(hochrechnung_hochrechnunggv)/count(startuhrzeit::time),2) as hochrechnunggv,\n" + //
"\tround(sum(hochrechnung_hochrechnungsv)/count(startuhrzeit::time),2) as hochrechnungsv,\n" + //
"\tround(sum(hochrechnungrad)/count(startuhrzeit::time)) as hochrechnungrad,\n" + //
Comment on lines +108 to +111
//for (Zeitintervall zeitintervall : allZeitintervalle) {
// log.debug(zeitintervall.getFahrbeziehung() + " " + zeitintervall.getType() + " " + zeitintervall.getStartUhrzeit() + " "
// + zeitintervall.getEndeUhrzeit() + " " + zeitintervall.getPkw());
//}
Comment on lines +5 to +26
SELECT sum(pkw), count(pkw), max(pkw), startuhrzeit::time FROM public.zeitintervall
where startuhrzeit between '2026-03-05' and '2026-03-06'
group by startuhrzeit::time order by startuhrzeit::time ASC limit 300;

SELECT sum(pkw)/(DATE_PART('day', '2026-03-06'::timestamp - '2026-03-05'::timestamp) + 1),
startuhrzeit::time
FROM public.zeitintervall
where startuhrzeit between '2026-03-05' and '2026-03-07' group by startuhrzeit::time
order by startuhrzeit::time ASC;

SELECT pkw, startuhrzeit::time, startuhrzeit::date,
DATE_PART('day', '2026-03-06'::timestamp - '2026-03-05'::timestamp)+1 FROM public.zeitintervall
where startuhrzeit between '2026-03-05' and '2026-03-07'
order by startuhrzeit::time ASC;

select sum(sumpkw),count(startuhrzeit::time), startuhrzeit::time from (
select sum(pkw) as sumpkw, startuhrzeit
FROM public.zeitintervall
where startuhrzeit between '2026-03-05' and '2026-03-12' and EXTRACT(DOW FROM startuhrzeit) IN (1, 2, 3, 4, 5)
and zaehlung_id = '339f992e-0925-4f6d-9e75-099bc520ad2c' group by startuhrzeit)
group by startuhrzeit::time order by startuhrzeit::time ASC;

Comment on lines +337 to +345
} else if (zaehlung.getDauerzaehlung() && options.getZeitraum().size() == 2
&& StringUtils.equals(options.getZeitauswahl(), LadeZaehldatenService.ZEITAUSWAHL_ZEITRAUM)) {
List<Zeitintervall> zeitintervalle = extractZeitintervalleWochentagsdurchschnitt(zaehlungId, options);
ladeZaehldaten = zeitintervalle.stream()
.map(zeitintervall -> mapToZaehldatum(zeitintervall, pkwEinheit, options))
.collect(Collectors.toList());
//ladeZaehldaten = extractZeitintervalleWochentagsdurchschnitt(zaehlungId, options, pkwEinheit);
} else {
List<Zeitintervall> zeitintervalle = extractZeitintervalle(zaehlungId, zaehlung.getZaehldauer(), zaehlung.getKreisverkehr(), options);
@witchpou witchpou merged commit 1c0d1a2 into sprint Mar 18, 2026
6 checks passed
@witchpou witchpou deleted the feature/ab#2146-correct-ganglinien-and-table-for-time-period branch March 18, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants