From c3d34bc3c6fbd408e7232918a61bde0211d0ce4e Mon Sep 17 00:00:00 2001 From: Rasmus Fuhse Date: Wed, 3 Jan 2024 15:03:47 +0000 Subject: Resolve "Likertskala und Polskala sollen absolute Zahlen in der Auswertungen anzeigen" Closes #2911 Merge request studip/studip!1963 --- .../question_types/likert/likert_evaluation.php | 60 ++++++++++++++- .../rangescale/rangescale_evaluation.php | 88 ++++++++++++++++++---- .../assets/stylesheets/scss/questionnaire.scss | 79 +++++++++++++++++++ 3 files changed, 208 insertions(+), 19 deletions(-) diff --git a/app/views/questionnaire/question_types/likert/likert_evaluation.php b/app/views/questionnaire/question_types/likert/likert_evaluation.php index ac0a671..fd4eb01 100644 --- a/app/views/questionnaire/question_types/likert/likert_evaluation.php +++ b/app/views/questionnaire/question_types/likert/likert_evaluation.php @@ -17,6 +17,12 @@ $options = $vote->questiondata['options']; + + + + + + @@ -34,7 +40,17 @@ $options = $vote->questiondata['options']; - $option) : ?> + 0) { + foreach ($answers as $answer) { + $average += $answer['answerdata']['answers'][$key]; + } + $average /= count($answers); + } + ?> + + $option) : ?> questiondata['options']; } } } - $color = 'hsl(0 0% '.round(70 + (30 * (1 - ($hits / $countAnswers ?? 1)) )).'%)'; ?> - diff --git a/app/views/questionnaire/question_types/rangescale/rangescale_evaluation.php b/app/views/questionnaire/question_types/rangescale/rangescale_evaluation.php index 9fa5748..2715934 100644 --- a/app/views/questionnaire/question_types/rangescale/rangescale_evaluation.php +++ b/app/views/questionnaire/question_types/rangescale/rangescale_evaluation.php @@ -17,11 +17,17 @@ $options = range($vote->questiondata['minimum'], $vote->questiondata['maximum'])
0 ? 'title="'.htmlReady(implode(', ', $names)).'"' : ''?>> + 0 ? 'title="'.htmlReady(implode(', ', $names)).'"' : ''?>> + +
+ Ø +
+ + 0) : ?> +
+ + + 0 ? ($bubble_width - 14) * $hits / $countAnswers + 14 : 0 ?> + 0 ? ($font_size - 0.5) * $hits / $countAnswers + 0.5 : 0 ?> +
+
+ +
+
asImg(16, ['class' => 'text-bottom']) ?> %
+
+
+ +
+
%
+ + 0% +
+ + + + + + questiondata['minimum'] ?? 1; $i <= $vote->questiondata['maximum']; $i++) : ?> - + @@ -33,7 +39,18 @@ $options = range($vote->questiondata['minimum'], $vote->questiondata['maximum']) - + 0) { + foreach ($answers as $answer) { + $average += $answer['answerdata']['answers'][$key]; + } + $average /= count($answers); + $average = round($average, 2); + } + ?> + + $option) : ?> questiondata['minimum'], $vote->questiondata['maximum']) } } } - $color = 'hsl(0 0% '.round(70 + (30 * (1 - ($hits / $countAnswers ?? 1)) )).'%)'; ?> - diff --git a/resources/assets/stylesheets/scss/questionnaire.scss b/resources/assets/stylesheets/scss/questionnaire.scss index 7591be4..f5e726b 100644 --- a/resources/assets/stylesheets/scss/questionnaire.scss +++ b/resources/assets/stylesheets/scss/questionnaire.scss @@ -342,6 +342,85 @@ $width: 270px; color: var(--red); } } + + .average { + position: absolute; + border-left: 2px solid var(--red); + height: 70px; + z-index: 1; + font-size: 0.7em; + padding-left: 5px; + } + .rangescale_center { + text-align: center; + } + .centerline { + border-top: 1px solid var(--base-color); + position: relative; + top: 35px; + margin-left: -5px; + margin-right: -5px; + z-index: 2; + } + .questionnaire-evaluation-circle-container { + text-align: center; + display: block; + .questionnaire-evaluation-circle { + width: 70px; + height: 70px; + display: flex; + justify-content: center; + align-items: center; + margin-left: auto; + margin-right: auto; + z-index: 3; + position: relative; + > .value { + border-radius: 100px; + color: var(--white); + display: flex; + justify-content: center; + align-items: center; + background-color: var(--base-color); + width: 100%; + height: 100%; + } + } + } + + .centerline { + border-top: 1px solid var(--base-color); + position: relative; + top: 35px; + margin-left: -5px; + margin-right: -5px; + z-index: 2; + } + .questionnaire-evaluation-circle-container { + text-align: center; + display: block; + .questionnaire-evaluation-circle { + width: 70px; + height: 70px; + display: flex; + justify-content: center; + align-items: center; + margin-left: auto; + margin-right: auto; + z-index: 3; + position: relative; + > .value { + border-radius: 100px; + color: white; + display: flex; + justify-content: center; + align-items: center; + background-color: var(--base-color); + width: 100%; + height: 100%; + } + } + } } .courseselector, -- cgit v1.0
0 ? 'title="'.htmlReady(implode(', ', $names)).'"' : ''?>> - - - asImg(16, ['class' => 'text-bottom']) ?> - % - + 0 ? 'title="'.htmlReady(implode(', ', $names)).'"' : ''?>> + 0) : ?> +
+ Ø +
+ + + 0) : ?> +
+ + + 0 ? ($bubble_width - 14) * $hits / $countAnswers + 14 : 0 ?> + 0 ? ($font_size - 0.5) * $hits / $countAnswers + 0.5 : 0 ?> + + +
+
+ +
+
+ asImg(16, ['class' => 'text-bottom']) ?> + % +
+ + +
+
+ +
+
+ % +
+ - - % - + 0%