Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b8a62b3
Add evaluation view #1467
kcinay055679 Mar 18, 2025
805231c
Add keyresults_amount column to evaluation view #1467
kcinay055679 Mar 18, 2025
56156c2
Add evaluation entity and embeddedId #1467
kcinay055679 Mar 18, 2025
946e63a
Add Evaluation Services #1467
kcinay055679 Mar 18, 2025
ed117bc
Add validationservice for EvaluationView #1467
kcinay055679 Mar 18, 2025
ed1f4c3
Add dto, mapper and controller for Evaluation #1464
kcinay055679 Mar 18, 2025
86f8e08
Implementing mapper properly #1467
kcinay055679 Mar 18, 2025
cee0353
Refine and clean up view #1467
kcinay055679 Mar 18, 2025
31ec4be
Add equals and hascode for EvaluationId #1467
kcinay055679 Mar 18, 2025
4d29d47
Add controllerIT for EvaluationView #1474
kcinay055679 Mar 18, 2025
9d23afc
Introduce testhelpers for EvaluationView #1474
kcinay055679 Mar 18, 2025
b8f6ca1
Add evaluatinView mapper tests #1475
kcinay055679 Mar 18, 2025
0031f11
Add businessServiceTest #1475
kcinay055679 Mar 20, 2025
111167c
Add validationServiceTest #1475
kcinay055679 Mar 20, 2025
93862a7
Update testing db schema and add persistenceIt #1475
kcinay055679 Mar 20, 2025
f9c84c0
clean up after testing #1475
kcinay055679 Mar 20, 2025
fc367db
Update swagger documentation #1474
kcinay055679 Mar 20, 2025
b90af87
Use coalesce on db view do convert null values to 0 #1474
kcinay055679 Mar 21, 2025
06e5ade
Use for loop in mapper #1477
kcinay055679 Mar 28, 2025
456248c
Make formatter happy #1467
kcinay055679 Mar 28, 2025
d358e0f
Feature/1478 statistics page frontend (#1484)
kcinay055679 Apr 23, 2025
60327d8
clean up
kcinay055679 Apr 29, 2025
6f8cc74
remove icons
kcinay055679 May 1, 2025
0047b40
add testcase for evaluation service
kcinay055679 May 2, 2025
bdf3264
clean up
kcinay055679 May 2, 2025
21ed004
update color of progress bars
kcinay055679 May 2, 2025
5ec2e32
add release notes
kcinay055679 May 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package ch.puzzle.okr.controller;

import ch.puzzle.okr.dto.EvaluationDto;
import ch.puzzle.okr.mapper.EvaluationViewMapper;
import ch.puzzle.okr.service.business.EvaluationViewBusinessService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v2/evaluation")
public class EvaluationViewController {

private final EvaluationViewMapper evaluationViewMapper;
private final EvaluationViewBusinessService evaluationViewBusinessService;

public EvaluationViewController(EvaluationViewMapper evaluationViewMapper,
EvaluationViewBusinessService evaluationViewBusinessService) {
this.evaluationViewMapper = evaluationViewMapper;
this.evaluationViewBusinessService = evaluationViewBusinessService;
}

@Operation(summary = "Get statistics data for multiple teams in a specific quarter", description = "Get the statistics data for multiple teams in a specific quarter")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Returned the statistics data for the requested teams and quarter", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = EvaluationDto.class)) }),
@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<EvaluationDto> getEvaluation(@RequestParam(name = "team")
@Parameter(description = "List of Team ids the statistics are requested for") List<Long> teamIds,
@RequestParam(name = "quarter")
@Parameter(description = "Quarter id the statistics are requested for ") Long quarterId) {
return ResponseEntity
.status(HttpStatus.OK)
.body(evaluationViewMapper
.toDto(evaluationViewBusinessService
.findByIds(evaluationViewMapper.fromDto(teamIds, quarterId))));
}
}
7 changes: 7 additions & 0 deletions backend/src/main/java/ch/puzzle/okr/dto/EvaluationDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ch.puzzle.okr.dto;

public record EvaluationDto(int objectiveAmount, int completedObjectivesAmount,
int successfullyCompletedObjectivesAmount, int keyResultAmount, int keyResultsOrdinalAmount,
int keyResultsMetricAmount, int keyResultsInTargetOrStretchAmount, int keyResultsInFailAmount,
int keyResultsInCommitAmount, int keyResultsInTargetAmount, int keyResultsInStretchAmount) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package ch.puzzle.okr.mapper;

import ch.puzzle.okr.dto.EvaluationDto;
import ch.puzzle.okr.models.evaluation.EvaluationView;
import ch.puzzle.okr.models.evaluation.EvaluationViewId;
import java.util.List;
import org.springframework.stereotype.Component;

@Component
public class EvaluationViewMapper {
public EvaluationDto toDto(List<EvaluationView> evaluationViews) {
int objectiveSum = 0;
int completedObjectivesSum = 0;
int successfullyCompletedObjectivesSum = 0;
int keyResultSum = 0;
int keyResultsOrdinalSum = 0;
int keyResultsMetricSum = 0;
int keyResultsInTargetOrStretchSum = 0;
int keyResultsInFailSum = 0;
int keyResultsInCommitSum = 0;
int keyResultsInTargetSum = 0;
int keyResultsInStretchSum = 0;

for (EvaluationView view : evaluationViews) {
objectiveSum += view.getObjectiveAmount();
completedObjectivesSum += view.getCompletedObjectivesAmount();
successfullyCompletedObjectivesSum += view.getSuccessfullyCompletedObjectivesAmount();
keyResultSum += view.getKeyResultAmount();
keyResultsOrdinalSum += view.getKeyResultsOrdinalAmount();
keyResultsMetricSum += view.getKeyResultsMetricAmount();
keyResultsInTargetOrStretchSum += view.getKeyResultsInTargetOrStretchAmount();
keyResultsInFailSum += view.getKeyResultsInFailAmount();
keyResultsInCommitSum += view.getKeyResultsInCommitAmount();
keyResultsInTargetSum += view.getKeyResultsInTargetAmount();
keyResultsInStretchSum += view.getKeyResultsInStretchAmount();
}

return new EvaluationDto(objectiveSum,
completedObjectivesSum,
successfullyCompletedObjectivesSum,
keyResultSum,
keyResultsOrdinalSum,
keyResultsMetricSum,
keyResultsInTargetOrStretchSum,
keyResultsInFailSum,
keyResultsInCommitSum,
keyResultsInTargetSum,
keyResultsInStretchSum);
}

public List<EvaluationViewId> fromDto(List<Long> teamIds, Long quarterId) {
return teamIds.stream().map(teamId -> new EvaluationViewId(teamId, quarterId)).toList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package ch.puzzle.okr.models.evaluation;

import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import java.util.Objects;
import org.hibernate.annotations.Immutable;

@Entity
@Immutable
public class EvaluationView {
@EmbeddedId
private EvaluationViewId evaluationViewId;

private int objectiveAmount;
private int completedObjectivesAmount;
private int successfullyCompletedObjectivesAmount;

private int keyResultAmount;
private int keyResultsOrdinalAmount;
private int keyResultsMetricAmount;
private int keyResultsInTargetOrStretchAmount;

private int keyResultsInFailAmount;
private int keyResultsInCommitAmount;
private int keyResultsInTargetAmount;
private int keyResultsInStretchAmount;

private EvaluationView(Builder builder) {
evaluationViewId = builder.evaluationViewId;
objectiveAmount = builder.objectiveAmount;
completedObjectivesAmount = builder.completedObjectivesAmount;
successfullyCompletedObjectivesAmount = builder.successfullyCompletedObjectivesAmount;
keyResultAmount = builder.keyResultAmount;
keyResultsOrdinalAmount = builder.keyResultsOrdinalAmount;
keyResultsMetricAmount = builder.keyResultsMetricAmount;
keyResultsInTargetOrStretchAmount = builder.keyResultsInTargetOrStretchAmount;
keyResultsInFailAmount = builder.keyResultsInFailAmount;
keyResultsInCommitAmount = builder.keyResultsInCommitAmount;
keyResultsInTargetAmount = builder.keyResultsInTargetAmount;
keyResultsInStretchAmount = builder.keyResultsInStretchAmount;
}

public EvaluationView() {
}

public EvaluationViewId getEvaluationViewId() {
return evaluationViewId;
}

public int getObjectiveAmount() {
return objectiveAmount;
}

public int getCompletedObjectivesAmount() {
return completedObjectivesAmount;
}

public int getSuccessfullyCompletedObjectivesAmount() {
return successfullyCompletedObjectivesAmount;
}

public int getKeyResultAmount() {
return keyResultAmount;
}

public int getKeyResultsOrdinalAmount() {
return keyResultsOrdinalAmount;
}

public int getKeyResultsMetricAmount() {
return keyResultsMetricAmount;
}

public int getKeyResultsInTargetOrStretchAmount() {
return keyResultsInTargetOrStretchAmount;
}

public int getKeyResultsInFailAmount() {
return keyResultsInFailAmount;
}

public int getKeyResultsInCommitAmount() {
return keyResultsInCommitAmount;
}

public int getKeyResultsInTargetAmount() {
return keyResultsInTargetAmount;
}

public int getKeyResultsInStretchAmount() {
return keyResultsInStretchAmount;
}

public static final class Builder {
private EvaluationViewId evaluationViewId;
private int objectiveAmount;
private int completedObjectivesAmount;
private int successfullyCompletedObjectivesAmount;
private int keyResultAmount;
private int keyResultsOrdinalAmount;
private int keyResultsMetricAmount;
private int keyResultsInTargetOrStretchAmount;
private int keyResultsInFailAmount;
private int keyResultsInCommitAmount;
private int keyResultsInTargetAmount;
private int keyResultsInStretchAmount;

private Builder() {
}

public static Builder builder() {
return new Builder();
}

public Builder withEvaluationViewId(EvaluationViewId val) {
evaluationViewId = val;
return this;
}

public Builder withObjectiveAmount(int val) {
objectiveAmount = val;
return this;
}

public Builder withCompletedObjectivesAmount(int val) {
completedObjectivesAmount = val;
return this;
}

public Builder withSuccessfullyCompletedObjectivesAmount(int val) {
successfullyCompletedObjectivesAmount = val;
return this;
}

public Builder withKeyResultAmount(int val) {
keyResultAmount = val;
return this;
}

public Builder withKeyResultsOrdinalAmount(int val) {
keyResultsOrdinalAmount = val;
return this;
}

public Builder withKeyResultsMetricAmount(int val) {
keyResultsMetricAmount = val;
return this;
}

public Builder withKeyResultsInTargetOrStretchAmount(int val) {
keyResultsInTargetOrStretchAmount = val;
return this;
}

public Builder withKeyResultsInFailAmount(int val) {
keyResultsInFailAmount = val;
return this;
}

public Builder withKeyResultsInCommitAmount(int val) {
keyResultsInCommitAmount = val;
return this;
}

public Builder withKeyResultsInTargetAmount(int val) {
keyResultsInTargetAmount = val;
return this;
}

public Builder withKeyResultsInStretchAmount(int val) {
keyResultsInStretchAmount = val;
return this;
}

public EvaluationView build() {
return new EvaluationView(this);
}
}

@Override
public boolean equals(Object o) {
if (!(o instanceof EvaluationView that)) {
return false;
}
return getObjectiveAmount() == that.getObjectiveAmount()
&& getCompletedObjectivesAmount() == that.getCompletedObjectivesAmount()
&& getSuccessfullyCompletedObjectivesAmount() == that.getSuccessfullyCompletedObjectivesAmount()
&& getKeyResultAmount() == that.getKeyResultAmount()
&& getKeyResultsOrdinalAmount() == that.getKeyResultsOrdinalAmount()
&& getKeyResultsMetricAmount() == that.getKeyResultsMetricAmount()
&& getKeyResultsInTargetOrStretchAmount() == that.getKeyResultsInTargetOrStretchAmount()
&& getKeyResultsInFailAmount() == that.getKeyResultsInFailAmount()
&& getKeyResultsInCommitAmount() == that.getKeyResultsInCommitAmount()
&& getKeyResultsInTargetAmount() == that.getKeyResultsInTargetAmount()
&& getKeyResultsInStretchAmount() == that.getKeyResultsInStretchAmount()
&& Objects.equals(getEvaluationViewId(), that.getEvaluationViewId());
}

@Override
public int hashCode() {
return Objects
.hash(getEvaluationViewId(),
getObjectiveAmount(),
getCompletedObjectivesAmount(),
getSuccessfullyCompletedObjectivesAmount(),
getKeyResultAmount(),
getKeyResultsOrdinalAmount(),
getKeyResultsMetricAmount(),
getKeyResultsInTargetOrStretchAmount(),
getKeyResultsInFailAmount(),
getKeyResultsInCommitAmount(),
getKeyResultsInTargetAmount(),
getKeyResultsInStretchAmount());
}
}
Loading
Loading