MDL-54855 assign: Add missing field in get_assignments
authorPau Ferrer Ocaña <crazyserver@gmail.com>
Fri, 10 Jun 2016 14:38:22 +0000 (16:38 +0200)
committerPau Ferrer Ocaña <crazyserver@gmail.com>
Thu, 23 Jun 2016 13:05:17 +0000 (15:05 +0200)
mod/assign/externallib.php
mod/assign/tests/externallib_test.php
mod/assign/upgrade.txt

index d0924ca..bf4e37e 100644 (file)
@@ -378,6 +378,7 @@ class mod_assign_external extends external_api {
                      'm.markingworkflow, ' .
                      'm.markingallocation, ' .
                      'm.requiresubmissionstatement, '.
+                     'm.preventsubmissionnotingroup, '.
                      'm.intro, '.
                      'm.introformat';
         $coursearray = array();
@@ -439,6 +440,7 @@ class mod_assign_external extends external_api {
                         'markingworkflow' => $module->markingworkflow,
                         'markingallocation' => $module->markingallocation,
                         'requiresubmissionstatement' => $module->requiresubmissionstatement,
+                        'preventsubmissionnotingroup' => $module->preventsubmissionnotingroup,
                         'configs' => $configarray
                     );
 
@@ -521,6 +523,7 @@ class mod_assign_external extends external_api {
                 'markingworkflow' => new external_value(PARAM_INT, 'enable marking workflow'),
                 'markingallocation' => new external_value(PARAM_INT, 'enable marking allocation'),
                 'requiresubmissionstatement' => new external_value(PARAM_INT, 'student must accept submission statement'),
+                'preventsubmissionnotingroup' => new external_value(PARAM_INT, 'Prevent submission not in group', VALUE_OPTIONAL),
                 'configs' => new external_multiple_structure(self::get_assignments_config_structure(), 'configuration settings'),
                 'intro' => new external_value(PARAM_RAW,
                     'assignment intro, not allways returned because it deppends on the activity configuration', VALUE_OPTIONAL),
index c0805d4..e035af6 100644 (file)
@@ -231,6 +231,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase {
         $this->assertRegExp('@"' . $CFG->wwwroot . '/webservice/pluginfile.php/\d+/mod_assign/intro/intro\.txt"@', $assignment['intro']);
         $this->assertEquals(1, $assignment['markingworkflow']);
         $this->assertEquals(1, $assignment['markingallocation']);
+        $this->assertEquals(0, $assignment['preventsubmissionnotingroup']);
 
         $this->assertCount(1, $assignment['introattachments']);
         $this->assertEquals('introattachment.txt', $assignment['introattachments'][0]['filename']);
@@ -256,6 +257,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase {
         $this->assertArrayNotHasKey('introattachments', $assignment);
         $this->assertEquals(1, $assignment['markingworkflow']);
         $this->assertEquals(1, $assignment['markingallocation']);
+        $this->assertEquals(0, $assignment['preventsubmissionnotingroup']);
 
         $result = mod_assign_external::get_assignments(array($course2->id));
 
@@ -293,6 +295,7 @@ class mod_assign_external_testcase extends externallib_advanced_testcase {
         $this->assertArrayNotHasKey('introattachments', $assignment);
         $this->assertEquals(1, $assignment['markingworkflow']);
         $this->assertEquals(1, $assignment['markingallocation']);
+        $this->assertEquals(0, $assignment['preventsubmissionnotingroup']);
     }
 
     /**
index c445ad4..9188027 100644 (file)
@@ -1,5 +1,9 @@
 This files describes API changes in the assign code.
 
+=== 3.2 ===
+* External function mod_assign_external::get_assignments now returns additional optional fields:
+   - preventsubmissionnotingroup: Prevent submission not in group.
+
 === 3.1 ===
 * The feedback plugins now need to implement the is_feedback_modified() method. The default is to return true
   for backwards compatibiltiy.