diff options
| author | Finn Schneider <schneider@data-quest.de> | 2026-03-17 13:42:38 +0100 |
|---|---|---|
| committer | Finn Schneider <schneider@data-quest.de> | 2026-03-17 13:42:38 +0100 |
| commit | 7ff92562d33b02728e9933adbaa4840fdbfcb15b (patch) | |
| tree | 3fcc3668c92f63012cb08401bbb5022279283214 | |
| parent | 8ebb4078ad5385f8198c2f8c8d03326ff7f0a030 (diff) | |
switch from profile properties to questionnaire properties
| -rw-r--r-- | app/views/course/evaluation/index.php | 7 | ||||
| -rw-r--r-- | lib/models/Questionnaire.php | 17 |
2 files changed, 11 insertions, 13 deletions
diff --git a/app/views/course/evaluation/index.php b/app/views/course/evaluation/index.php index 19f6bdf..05f677d 100644 --- a/app/views/course/evaluation/index.php +++ b/app/views/course/evaluation/index.php @@ -6,7 +6,6 @@ <!-- TODO min responses --> <?php foreach ($controller->evaluations as $key => $evaluation) : ?> - <?php $profile = QuestionnaireEvalCentralProfile::find($evaluation->eval_assignment->semester_id) ?> <article class="studip toggle <?= $key == 0 ? 'open' : '' ?>"> <header> <h1> @@ -47,14 +46,14 @@ <tr> <th scope="row"><?= _('Einsicht für') ?></th> <td> - <?= $profile->result_visible_for ? - _(QuestionnaireEvalCentralProfile::RESULT_VISIBLE_FOR_OPTIONS[$profile->result_visible_for]) + <?= $evaluation->result_visible_for ? + _(QuestionnaireEvalCentralProfile::RESULT_VISIBLE_FOR_OPTIONS[$evaluation->result_visible_for]) : _('Evaluations-Admins') ?> </td> </tr> <tr> <th scope="row"><?= _('Mindestrücklauf') ?></th> - <td><?= htmlReady($profile->minimum_responses) ?></td> + <td><?= htmlReady($evaluation->minimum_responses) ?></td> </tr> </tbody> </table> diff --git a/lib/models/Questionnaire.php b/lib/models/Questionnaire.php index 0372c46..071419b 100644 --- a/lib/models/Questionnaire.php +++ b/lib/models/Questionnaire.php @@ -13,8 +13,10 @@ * @property int $visible database column * @property int $anonymous database column * @property string $resultvisibility database column + * @property string $result_visible_for database column * @property int $editanswers database column * @property int $copyable database column + * @property int $minimum_responses database column * @property int $chdate database column * @property int $mkdate database column * @property SimpleORMapCollection<QuestionnaireQuestion> $questions has_many QuestionnaireQuestion @@ -272,15 +274,12 @@ class Questionnaire extends SimpleORMap implements PrivacyObject return true; } - $eval_profile = QuestionnaireEvalCentralProfile::find($this->eval_assignment->semester_id); - - if ($eval_profile && $eval_profile->result_visible_for) { - $eval_visible = $user->hasPermissionLevel($eval_profile->result_visible_for, Context::get()); - } else { + if (!$this->result_visible_for) { return false; } + $eval_visible = $user->hasPermissionLevel($this->result_visible_for, Context::get()); - if ($eval_profile->anonymous) { + if ($this->anonymous) { $statement = DBManager::get()->prepare( "SELECT DISTINCT count(`user_id`) AS 'amount' FROM `questionnaire_anonymous_answers` WHERE `questionnaire_id` = :questionnaire_id"); @@ -296,10 +295,10 @@ class Questionnaire extends SimpleORMap implements PrivacyObject ]); $response_amount = $statement->fetch()['amount']; - $eval_visible = $eval_visible && ($response_amount >= $eval_profile->minimum_responses); + $eval_visible = $eval_visible && ($response_amount >= $this->minimum_responses); return $eval_visible - && ($eval_profile->resultvisibility === 'afterending' && $this->isStopped() - || $eval_profile->resultvisibility === 'afterparticipation' && $this->isAnswered()); + && ($this->resultvisibility === 'afterending' && $this->isStopped() + || $this->resultvisibility === 'afterparticipation' && $this->isAnswered()); } return $this['resultvisibility'] === 'always' |
