mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-37993 Quiz: completion upon all passing grade or attempts exhausted
This patch adds completion options to Quiz similar to what is available in scorm. One can have the quiz marked complete when either a passing grade is achieved or all attempts are used up. This will allow a quiz to complete when the user "passes or fails". (Where "fail" means "using up all attempts without passing".)
- Loading branch information
1 parent
7784c3a
commit db3686d
Showing
10 changed files
with
298 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
mod/quiz/tests/behat/completion_condition_attempts_used.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
@mod @mod_quiz | ||
Feature: Set a quiz to be marked complete when the student uses all attempts allowed | ||
In order to ensure a student has learned the material before being marked complete | ||
As a teacher | ||
I need to set a quiz to complete when the student receives a passing grade, or completed_fail if they use all attempts without passing | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| student1 | Student | 1 | student1@asd.com | | ||
| teacher1 | Teacher | 1 | teacher1@asd.com | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And I log in as "admin" | ||
And I set the following administration settings values: | ||
| Enable completion tracking | 1 | | ||
And I expand "Grades" node | ||
And I follow "Grade item settings" | ||
And I set the field "Advanced grade item options" to "hiddenuntil" | ||
And I press "Save changes" | ||
And I log out | ||
|
||
Scenario: student1 uses up both attempts without passing | ||
When I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I click on "Edit settings" "link" in the "Administration" "block" | ||
And I set the following fields to these values: | ||
| Enable completion tracking | Yes | | ||
And I press "Save changes" | ||
And I add a "Quiz" to section "1" and I fill the form with: | ||
| Name | Test quiz name | | ||
| Description | Test quiz description | | ||
| Completion tracking | Show activity as complete when conditions are met | | ||
| Attempts allowed | 2 | | ||
| Require passing grade | 1 | | ||
| Or all available attempts completed | 1 | | ||
And I add a "True/False" question to the "Test quiz name" quiz with: | ||
| Question name | First question | | ||
| Question text | Answer the first question | | ||
| General feedback | Thank you, this is the general feedback | | ||
| Correct answer | True | | ||
| Feedback for the response 'True'. | So you think it is true | | ||
| Feedback for the response 'False'. | So you think it is false | | ||
And I follow "Course 1" | ||
And I follow "Grades" | ||
And I follow "Simple view" | ||
And I follow "Edit quiz Test quiz name" | ||
Then I should see "Edit grade item" | ||
And I set the field "gradepass" to "5" | ||
And I press "Save changes" | ||
And I should see "Simple view" | ||
Then I log out | ||
|
||
And I log in as "student1" | ||
And I follow "Course 1" | ||
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I follow "Test quiz name" | ||
And I press "Attempt quiz now" | ||
And I should see "Question 1" | ||
And I should see "Answer the first question" | ||
And I set the field "False" to "1" | ||
And I press "Next" | ||
And I should see "Answer saved" | ||
And I press "Submit all and finish" | ||
And I follow "C1" | ||
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I follow "Test quiz name" | ||
And I press "Re-attempt quiz" | ||
Then I should see "Question 1" | ||
And I should see "Answer the first question" | ||
And I set the field "False" to "1" | ||
And I press "Next" | ||
And I should see "Answer saved" | ||
And I press "Submit all and finish" | ||
And I follow "C1" | ||
And "//img[contains(@alt, 'Completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I log out | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Activity completion" | ||
Then "//img[contains(@title,'Test quiz name') and @alt='Completed']" "xpath_element" should exist in the "Student 1" "table_row" | ||
|
87 changes: 87 additions & 0 deletions
87
mod/quiz/tests/behat/completion_condition_passing_grade.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
@mod @mod_quiz | ||
Feature: Set a quiz to be marked complete when the student passes | ||
In order to ensure a student has learned the material before being marked complete | ||
As a teacher | ||
I need to set a quiz to complete when the student recieves a passing grade | ||
|
||
Background: | ||
Given the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| student1 | Student | 1 | student1@asd.com | | ||
| teacher1 | Teacher | 1 | teacher1@asd.com | | ||
And the following "courses" exist: | ||
| fullname | shortname | category | | ||
| Course 1 | C1 | 0 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| student1 | C1 | student | | ||
And I log in as "admin" | ||
And I set the following administration settings values: | ||
| Enable completion tracking | 1 | | ||
And I expand "Grades" node | ||
And I follow "Grade item settings" | ||
And I set the field "Advanced grade item options" to "hiddenuntil" | ||
And I press "Save changes" | ||
And I log out | ||
|
||
Scenario: student1 passes on the first try | ||
When I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I turn editing mode on | ||
And I click on "Edit settings" "link" in the "Administration" "block" | ||
And I set the following fields to these values: | ||
| Enable completion tracking | Yes | | ||
And I press "Save changes" | ||
And I add a "Quiz" to section "1" and I fill the form with: | ||
| Name | Test quiz name | | ||
| Description | Test quiz description | | ||
| Completion tracking | Show activity as complete when conditions are met | | ||
| Attempts allowed | 4 | | ||
| Require passing grade | 1 | | ||
And I add a "True/False" question to the "Test quiz name" quiz with: | ||
| Question name | First question | | ||
| Question text | Answer the first question | | ||
| General feedback | Thank you, this is the general feedback | | ||
| Correct answer | True | | ||
| Feedback for the response 'True'. | So you think it is true | | ||
| Feedback for the response 'False'. | So you think it is false | | ||
And I follow "Course 1" | ||
And I follow "Grades" | ||
And I select "Simple view" from "jump" | ||
And I press "Go" | ||
And I follow "Edit quiz Test quiz name" | ||
Then I should see "Edit grade item" | ||
And I set the field "gradepass" to "5" | ||
And I press "Save changes" | ||
Then I should see "Simple view" | ||
And I log out | ||
|
||
And I log in as "student1" | ||
And I follow "Course 1" | ||
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I follow "Test quiz name" | ||
And I press "Attempt quiz now" | ||
Then I should see "Question 1" | ||
And I should see "Answer the first question" | ||
And I set the field "False" to "1" | ||
And I press "Next" | ||
And I should see "Answer saved" | ||
And I press "Submit all and finish" | ||
And I follow "C1" | ||
And "//img[contains(@alt, 'Not completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I follow "Test quiz name" | ||
And I press "Re-attempt quiz" | ||
Then I should see "Question 1" | ||
And I should see "Answer the first question" | ||
And I set the field "True" to "1" | ||
And I press "Next" | ||
And I should see "Answer saved" | ||
And I press "Submit all and finish" | ||
And I follow "C1" | ||
And "//img[contains(@alt, 'Completed: Test quiz name')]" "xpath_element" should exist in the "li.modtype_quiz" "css_element" | ||
And I log out | ||
And I log in as "teacher1" | ||
And I follow "Course 1" | ||
And I follow "Activity completion" | ||
Then "//img[contains(@title,'Test quiz name') and @alt='Completed']" "xpath_element" should exist in the "Student 1" "table_row" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters