Merge branch 'wip-MDL-56370-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE
This commit is contained in:
@@ -401,6 +401,21 @@ class mod_feedback_completion extends mod_feedback_structure {
|
||||
return $this->completedtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* If user has already completed the feedback, create the temproray values from last completed attempt
|
||||
*
|
||||
* @return stdClass record from feedback_completedtmp or false if not found
|
||||
*/
|
||||
public function create_completed_tmp_from_last_completed() {
|
||||
if (!$this->get_current_completed_tmp()) {
|
||||
$lastcompleted = $this->find_last_completed();
|
||||
if ($lastcompleted) {
|
||||
$this->completedtmp = feedback_set_tmp_values($lastcompleted);
|
||||
}
|
||||
}
|
||||
return $this->completedtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves unfinished response to the temporary table
|
||||
*
|
||||
|
||||
@@ -92,6 +92,7 @@ $cansubmit = $feedbackcompletion->can_submit();
|
||||
|
||||
// Initialise the form processing feedback completion.
|
||||
if (!$feedbackcompletion->is_empty() && $cansubmit) {
|
||||
$feedbackcompletion->create_completed_tmp_from_last_completed();
|
||||
$form = new mod_feedback_complete_form(mod_feedback_complete_form::MODE_COMPLETE,
|
||||
$feedbackcompletion, 'feedback_complete_form', array('gopage' => $gopage));
|
||||
if ($form->is_cancelled()) {
|
||||
|
||||
@@ -1881,8 +1881,6 @@ function feedback_print_item_show_value($item, $value = false) {
|
||||
*/
|
||||
function feedback_set_tmp_values($feedbackcompleted) {
|
||||
global $DB;
|
||||
debugging('Function feedback_set_tmp_values() is deprecated and since it is '
|
||||
. 'no longer used in mod_feedback', DEBUG_DEVELOPER);
|
||||
|
||||
//first we create a completedtmp
|
||||
$tmpcpl = new stdClass();
|
||||
|
||||
@@ -73,6 +73,24 @@ class behat_mod_feedback extends behat_base {
|
||||
$this->execute("behat_forms::press_button", $saveitem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a question to the existing feedback with filling the form.
|
||||
*
|
||||
* The form for creating a question should be on one page.
|
||||
*
|
||||
* @When /^I add a page break to the feedback$/
|
||||
*/
|
||||
public function i_add_a_page_break_to_the_feedback() {
|
||||
|
||||
$questiontype = $this->escape(get_string('add_pagebreak', 'feedback'));
|
||||
$additem = $this->escape(get_string('add_item', 'feedback'));
|
||||
|
||||
$this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, $additem));
|
||||
|
||||
// Wait again, for page to reloaded.
|
||||
$this->execute('behat_general::i_wait_to_be_redirected');
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick way to generate answers to a one-page feedback.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
@mod @mod_feedback
|
||||
Feature: Non anonymous feedback with multiple submissions
|
||||
In order to modify feedback response
|
||||
As a student
|
||||
I need to be able to see previous response when I re-submit feedback
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| user1 | Username | 1 |
|
||||
| user2 | Username | 2 |
|
||||
| teacher | Teacher | 3 |
|
||||
| manager | Manager | 4 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| user1 | C1 | student |
|
||||
| user2 | C1 | student |
|
||||
| teacher | C1 | editingteacher |
|
||||
And the following "activities" exist:
|
||||
| activity | name | course | idnumber | anonymous | publish_stats | multiple_submit | section |
|
||||
| feedback | Course feedback | C1 | feedback1 | 2 | 1 | 1 | 0 |
|
||||
|
||||
Scenario: Completing a feedback second time
|
||||
When I log in as "teacher"
|
||||
And I follow "Course 1"
|
||||
And I follow "Course feedback"
|
||||
And I click on "Edit questions" "link" in the "[role=main]" "css_element"
|
||||
And I add a "Short text answer" question to the feedback with:
|
||||
| Question | first |
|
||||
| Label | shorttext1 |
|
||||
| Maximum characters accepted | 200 |
|
||||
And I add a page break to the feedback
|
||||
And I add a "Short text answer" question to the feedback with:
|
||||
| Question | second |
|
||||
| Label | shorttext2 |
|
||||
| Maximum characters accepted | 200 |
|
||||
And I log out
|
||||
And I log in as "user1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Course feedback"
|
||||
And I follow "Answer the questions..."
|
||||
And I set the following fields to these values:
|
||||
| first | 111 |
|
||||
And I press "Next"
|
||||
And I set the following fields to these values:
|
||||
| second | 222 |
|
||||
And I press "Submit your answers"
|
||||
And I log out
|
||||
And I log in as "user1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Course feedback"
|
||||
And I follow "Answer the questions..."
|
||||
Then the field "first" matches value "111"
|
||||
And I press "Next"
|
||||
And the field "second" matches value "222"
|
||||
And I set the following fields to these values:
|
||||
| second | 333 |
|
||||
And I press "Submit your answers"
|
||||
Reference in New Issue
Block a user