mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-75744 gapselect: remove empty choices option.
This commit is contained in:
parent
c6211a68b4
commit
aee466c0fc
@ -142,18 +142,10 @@ class qtype_gapselect_edit_form_base extends question_edit_form {
|
||||
$textboxgroup[] = $mform->createElement('group', 'choices',
|
||||
get_string('choicex', 'qtype_gapselect'), $this->choice_group($mform));
|
||||
|
||||
if (isset($this->question->options)) {
|
||||
$countanswers = count($this->question->options->answers);
|
||||
if (!empty($this->question->options->answers)) {
|
||||
$repeatsatstart = count($this->question->options->answers);
|
||||
} else {
|
||||
$countanswers = 0;
|
||||
}
|
||||
|
||||
if ($this->question->formoptions->repeatelements) {
|
||||
$defaultstartnumbers = QUESTION_NUMANS_START * 2;
|
||||
$repeatsatstart = max($defaultstartnumbers, QUESTION_NUMANS_START,
|
||||
$countanswers + QUESTION_NUMANS_ADD);
|
||||
} else {
|
||||
$repeatsatstart = $countanswers;
|
||||
$repeatsatstart = QUESTION_NUMANS_ADD * 2;
|
||||
}
|
||||
|
||||
$repeatedoptions = $this->repeated_options();
|
||||
|
@ -37,3 +37,35 @@ Feature: Test creating a Select missing words question
|
||||
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
||||
And the following fields match these values:
|
||||
| id_shuffleanswers | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Edit a Select missing words question with 2 choice and should not have empty choice.
|
||||
Given I am on the "Course 1" "core_question > course question bank" page logged in as teacher
|
||||
And I add a "Select missing words" question filling the form with:
|
||||
| Question name | Select missing words 002 |
|
||||
| Question text | The [[1]] [[2]] on the mat. |
|
||||
| General feedback | The cat sat on the mat. |
|
||||
| id_shuffleanswers | 1 |
|
||||
| id_choices_0_answer | cat |
|
||||
| id_choices_1_answer | sat |
|
||||
| id_choices_2_answer | dog |
|
||||
| id_choices_2_choicegroup | 2 |
|
||||
| id_choices_3_answer | stand |
|
||||
| id_choices_3_choicegroup | 2 |
|
||||
| Hint 1 | First hint |
|
||||
| Hint 2 | Second hint |
|
||||
When I choose "Edit question" action for "Select missing words 002" in the question bank
|
||||
And the following fields match these values:
|
||||
| Question name | Select missing words 002 |
|
||||
| Question text | The [[1]] [[2]] on the mat. |
|
||||
| General feedback | The cat sat on the mat. |
|
||||
| id_shuffleanswers | 1 |
|
||||
| id_choices_0_answer | cat |
|
||||
| id_choices_1_answer | sat |
|
||||
| id_choices_2_answer | dog |
|
||||
| id_choices_2_choicegroup | 2 |
|
||||
| id_choices_3_answer | stand |
|
||||
| id_choices_3_choicegroup | 2 |
|
||||
| Hint 1 | First hint |
|
||||
| Hint 2 | Second hint |
|
||||
Then I should not see "Choice [[5]]"
|
||||
|
Loading…
x
Reference in New Issue
Block a user