Skip to content

Commit

Permalink
Max Score REK-79
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Wojczal committed Dec 2, 2024
1 parent 1b84f86 commit 0c76088
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Enums/QuestionnaireRateMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@ class QuestionnaireRateMap extends Enum
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
];
}
2 changes: 2 additions & 0 deletions src/Services/QuestionnaireAnswerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public function getStars(int $modelTypeId, int $modelId): array
$report = $this->questionAnswerRepository->getStars($modelTypeId, $modelId);
$countRates = 0;
$sumRates = 0;
// TODO: this map should be dynamic and calculated from the max score of the question
$rateMap = QuestionnaireRateMap::RATE_MAP;

$report->each(function ($rates) use (&$rateMap, &$sumRates, &$countRates) {
// @phpstan-ignore-next-line
if (isset($rateMap[$rates->rate])) {
Expand Down

0 comments on commit 0c76088

Please sign in to comment.