Skip to content

Commit

Permalink
Test: Add Check for Invalid Passing Marks
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Jan 14, 2025
1 parent 9668b0a commit 76dc7cb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion components/ILIAS/Test/src/Scoring/Marks/MarkSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function checkForMissingZeroPercentage(): bool
return true;
}

public function checkForMissingPassed(): bool|string
public function checkForMissingPassed(): bool
{
foreach ($this->mark_steps as $step) {
if ($step->getPassed() === true) {
Expand All @@ -122,6 +122,20 @@ public function checkForMissingPassed(): bool|string
return true;
}

public function checkForFailedAfterPassed(): bool
{
$has_to_be_passed = false;
foreach ($this->mark_steps as $step) {
if ($has_to_be_passed && !$step->getPassed()) {
return true;
}
if ($step->getPassed() === true) {
$has_to_be_passed = true;
}
}
return false;
}

/**
* @return Mark[]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ private function checkSchemaForErrors(MarkSchema $new_schema): MarkSchema|string
if ($new_schema->checkForMissingZeroPercentage()) {
$messages[] = $this->lng->txt('min_percentage_ne_0');
}
if ($new_schema->checkForFailedAfterPassed()) {
$messages[] = $this->lng->txt('no_passed_after_failed');
}

if (isset($messages[1])) {
$messages[0] .= '<br>' . $messages[1];
Expand Down
1 change: 1 addition & 0 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ assessment#:#new_unit#:#Neue Einheit
assessment#:#next_question#:#Weiter
assessment#:#next_question_rows#:#Fragen %d - %d von %d →
assessment#:#no_manual_feedback_export_info#:#Manuelle Rückmeldungen werden nicht exportiert.
assessment#:#no_passed_after_failed#:#Alle als bestanden markierten Notenschritte müssen höhere Mindestprozentsätze haben als die als nicht bestanden markierten.
assessment#:#no_passed_mark#:#Sie müssen wenigstens einen Notenschritt als BESTANDEN markieren!
assessment#:#no_question_selected_for_move#:#Bitte wählen Sie mindestens eine Frage aus, um sie zu verschieben!
assessment#:#no_questions_available#:#Es sind keine Fragen verfügbar!
Expand Down
1 change: 1 addition & 0 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ assessment#:#new_unit#:#New Unit
assessment#:#next_question#:#Next
assessment#:#next_question_rows#:#Questions %d - %d of %d →
assessment#:#no_manual_feedback_export_info#:#Manual feedbacks will not be exported.
assessment#:#no_passed_after_failed#:#Failing marks cannot have a higher minimum level than any passing mark.
assessment#:#no_passed_mark#:#At least one grade has to be a passing grade. For a grade to be a passing grade, it needs to have the appropriate box in the ‘Passed’ column checked.
assessment#:#no_question_selected_for_move#:#Please check at least one question to move it!
assessment#:#no_questions_available#:#There are no questions available!
Expand Down

0 comments on commit 76dc7cb

Please sign in to comment.