diff --git a/backend/src/main/java/ch/puzzle/okr/controller/EvaluationViewController.java b/backend/src/main/java/ch/puzzle/okr/controller/EvaluationViewController.java index b0a46975fd..8c97bd1441 100644 --- a/backend/src/main/java/ch/puzzle/okr/controller/EvaluationViewController.java +++ b/backend/src/main/java/ch/puzzle/okr/controller/EvaluationViewController.java @@ -37,7 +37,7 @@ public EvaluationViewController(EvaluationViewMapper evaluationViewMapper, @ApiResponse(responseCode = "404", description = "The quarter or one of the teams were not found", content = @Content), @ApiResponse(responseCode = "401", description = "Not Authorized", content = @Content) }) @GetMapping("") - public ResponseEntity getEvaluation(@RequestParam(name = "team") + public ResponseEntity getEvaluation(@RequestParam(name = "team", required = false) @Parameter(description = "List of Team ids the statistics are requested for") List teamIds, @RequestParam(name = "quarter") @Parameter(description = "Quarter id the statistics are requested for ") Long quarterId) { diff --git a/backend/src/main/java/ch/puzzle/okr/service/validation/EvaluationViewValidationService.java b/backend/src/main/java/ch/puzzle/okr/service/validation/EvaluationViewValidationService.java index 851381238a..d701b1eba2 100644 --- a/backend/src/main/java/ch/puzzle/okr/service/validation/EvaluationViewValidationService.java +++ b/backend/src/main/java/ch/puzzle/okr/service/validation/EvaluationViewValidationService.java @@ -15,22 +15,18 @@ public class EvaluationViewValidationService ValidationBase { private final QuarterValidationService quarterValidationService; - private final TeamValidationService teamValidationService; EvaluationViewValidationService(EvaluationViewPersistenceService persistenceService, - QuarterValidationService quarterValidationService, - TeamValidationService teamValidationService) { + QuarterValidationService quarterValidationService) { super(persistenceService); this.quarterValidationService = quarterValidationService; - this.teamValidationService = teamValidationService; } public void validateOnGet(TeamQuarterFilter filter) { - if (filter.quarterId() == null || filter.teamIds().isEmpty()) { + if (filter.quarterId() == null) { throw new OkrResponseStatusException(HttpStatus.BAD_REQUEST, - "Es muss mindestens 1 Team und 1 Quartal ausgewählt sein"); + "Es muss mindestens 1 Quartal ausgewählt sein"); } - filter.teamIds().forEach(teamValidationService::validateOnGet); quarterValidationService.validateOnGet(filter.quarterId()); } diff --git a/backend/src/test/java/ch/puzzle/okr/service/validation/EvaluationViewValidationServiceTest.java b/backend/src/test/java/ch/puzzle/okr/service/validation/EvaluationViewValidationServiceTest.java index dc0e34bb56..18a69ee9aa 100644 --- a/backend/src/test/java/ch/puzzle/okr/service/validation/EvaluationViewValidationServiceTest.java +++ b/backend/src/test/java/ch/puzzle/okr/service/validation/EvaluationViewValidationServiceTest.java @@ -26,7 +26,6 @@ class EvaluationViewValidationServiceTest { void shouldCallProperMethodsToValidateOnGet() { TeamQuarterFilter ids = new TeamQuarterFilter(List.of(1L, 2L), 1L); evaluationViewValidationService.validateOnGet(ids); - verify(teamValidationService, times(2)).validateOnGet(any()); verify(quarterValidationService, times(1)).validateOnGet(any()); } } diff --git a/frontend/src/app/shared/application-page/application-page.component.html b/frontend/src/app/shared/application-page/application-page.component.html index 954fa9316b..ab27474374 100644 --- a/frontend/src/app/shared/application-page/application-page.component.html +++ b/frontend/src/app/shared/application-page/application-page.component.html @@ -6,7 +6,8 @@ > -
+ @if ((elements$ | async)?.length === 0 || getFilterPageChange().teamIds.length === 0) { +

Kein Team ausgewählt

+ }
diff --git a/frontend/src/app/statistics/statistics-information/statistics-information.component.spec.ts b/frontend/src/app/statistics/statistics-information/statistics-information.component.spec.ts index 2be7fc5036..1810ec732d 100644 --- a/frontend/src/app/statistics/statistics-information/statistics-information.component.spec.ts +++ b/frontend/src/app/statistics/statistics-information/statistics-information.component.spec.ts @@ -33,21 +33,18 @@ describe('StatisticsInformationComponent', () => { [0, 50, '0px'], - [10, + [0.5, 50, - '1000px'], // 10 * 100 = 1000px + '25px'], // 0.5 * 50 = 25px [1, 50, - '100px'], // 1 * 100 = 100px - [25, + '50px'], // 1 * 50 = 50px + [0.75, 50, - '2500px'], // 25 * 100 = 2500px - [10, - 100, - '1000px'], // 10 * 100 = 1000px (maxHeightInPx doesn't affect the result) - [5, + '37.5px'], // 0.75 * 50 = 37.5px + [0.5, 20, - '500px'] // 5 * 100 = 500px + '10px'] // 0.5 * 20 = 10px ])('with chartValue %i and maxHeightInPx %i, should return %s', (chartValue, maxHeightInPx, expectedHeight) => { component.chartValue = chartValue; component.maxHeightInPx = maxHeightInPx; diff --git a/frontend/src/app/statistics/statistics-information/statistics-information.component.ts b/frontend/src/app/statistics/statistics-information/statistics-information.component.ts index be378f7376..7113db8bbb 100644 --- a/frontend/src/app/statistics/statistics-information/statistics-information.component.ts +++ b/frontend/src/app/statistics/statistics-information/statistics-information.component.ts @@ -20,8 +20,8 @@ export class StatisticsInformationComponent { @Input() maxHeightInPx = 50; get chartHeight(): string { - const percentage = this.chartValue / this.maxHeightInPx * 100; - const heightInPx = percentage * this.maxHeightInPx; + // Chart value is already a percentage. We can expect it to never be higher than 1. + const heightInPx = this.chartValue * this.maxHeightInPx; return heightInPx + 'px'; } } diff --git a/frontend/src/app/statistics/statistics.component.html b/frontend/src/app/statistics/statistics.component.html index 3fdd797c29..5ba6165570 100644 --- a/frontend/src/app/statistics/statistics.component.html +++ b/frontend/src/app/statistics/statistics.component.html @@ -20,18 +20,21 @@

Auswertung

Quartal - + -
+ @if (activeFilter?.teamIds?.length != 0) { + @if (statistics | async; as statistics) { +
+ @if (statistics.objectiveAmount == 0 && statistics.keyResultAmount == 0) {
Für dieses Team ist im ausgewählten Zeitraum kein Objective vorhanden.
+ }
{{ statistics.objectiveAmount }} @@ -74,9 +77,9 @@

Auswertung

+ @if (krRelation(statistics.keyResultsMetricAmount, statistics.keyResultsOrdinalAmount); as relation) { Auswertung {{ statistics.keyResultsOrdinalAmount }} + } + @if (krProgressRelation(statistics); as relation) { Auswertung {{ relation.stretch | percent : '1.0-1' }} + }
+ } + }
diff --git a/frontend/src/app/statistics/statistics.component.ts b/frontend/src/app/statistics/statistics.component.ts index 1d90699929..bc2a0c2d3f 100644 --- a/frontend/src/app/statistics/statistics.component.ts +++ b/frontend/src/app/statistics/statistics.component.ts @@ -14,9 +14,12 @@ export class StatisticsComponent { statistics = new Observable(); - loadOverview(filterpage: FilterPageChange) { + activeFilter: FilterPageChange | undefined; + + loadOverview(filterPage: FilterPageChange) { + this.activeFilter = filterPage; this.statistics = this.evaluationService - .getStatistics(filterpage.quarterId, filterpage.teamIds) + .getStatistics(filterPage.quarterId, filterPage.teamIds) .pipe(catchError(() => { return EMPTY; }));