-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/1467 statistics page #1482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 805231c
Add keyresults_amount column to evaluation view #1467
kcinay055679 56156c2
Add evaluation entity and embeddedId #1467
kcinay055679 946e63a
Add Evaluation Services #1467
kcinay055679 ed117bc
Add validationservice for EvaluationView #1467
kcinay055679 ed1f4c3
Add dto, mapper and controller for Evaluation #1464
kcinay055679 86f8e08
Implementing mapper properly #1467
kcinay055679 cee0353
Refine and clean up view #1467
kcinay055679 31ec4be
Add equals and hascode for EvaluationId #1467
kcinay055679 4d29d47
Add controllerIT for EvaluationView #1474
kcinay055679 9d23afc
Introduce testhelpers for EvaluationView #1474
kcinay055679 b8f6ca1
Add evaluatinView mapper tests #1475
kcinay055679 0031f11
Add businessServiceTest #1475
kcinay055679 111167c
Add validationServiceTest #1475
kcinay055679 93862a7
Update testing db schema and add persistenceIt #1475
kcinay055679 f9c84c0
clean up after testing #1475
kcinay055679 fc367db
Update swagger documentation #1474
kcinay055679 b90af87
Use coalesce on db view do convert null values to 0 #1474
kcinay055679 06e5ade
Use for loop in mapper #1477
kcinay055679 456248c
Make formatter happy #1467
kcinay055679 d358e0f
Feature/1478 statistics page frontend (#1484)
kcinay055679 60327d8
clean up
kcinay055679 6f8cc74
remove icons
kcinay055679 0047b40
add testcase for evaluation service
kcinay055679 bdf3264
clean up
kcinay055679 21ed004
update color of progress bars
kcinay055679 5ec2e32
add release notes
kcinay055679 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
backend/src/main/java/ch/puzzle/okr/controller/EvaluationViewController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)))); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | ||
| } |
54 changes: 54 additions & 0 deletions
54
backend/src/main/java/ch/puzzle/okr/mapper/EvaluationViewMapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
215 changes: 215 additions & 0 deletions
215
backend/src/main/java/ch/puzzle/okr/models/evaluation/EvaluationView.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.