Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-73929

Workshop self-assessment settings static is rendered incorrectly in the scheduled allocation form

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.11.5, 4.0
    • Workshop
    • MOODLE_311_STABLE, MOODLE_400_STABLE

      When self-assessment is disabled for the workshop instance, it should say so on the allocation form: Add self-assessment - Self-assessment disabled. However, once the allocation is created, the text disappears from this static field. See screenshot. 

      This is because both checkbox and static label share the same id: "addselfassessment". But, once allocation is created, this value is evaluated in instance_from_object function of random allocation lib.php:765. So it's explicitly set to 'false' thus losing the text value.

      foreach (array('excludesamegroup', 'removecurrent', 'assesswosubmission', 'addselfassessment') as $k) {
        if (isset($data->$k)) {
          $i->$k = (bool)$data->$k;
        } else {
          $i->$k = false;
        }
      }
      

      A dirty fix would be to simply rename the static filed to something else in settings_form.php of random allocation, so it's different from the checkbox id.

      if (empty($workshop->useselfassessment)) {
      $mform->addElement('static', 'noselfassessment', get_string('addselfassessment', 'workshopallocation_random'),
      get_string('selfassessmentdisabled', 'workshop'));
      } else {
      $mform->addElement('checkbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
      }

       
      Steps to reproduce:

      1. Create a workshop with 'Assessment settings: Use self-assessment: No'
      2. Visit 'Allocate submissions' view from the workshop administration block
      3. Switch to 'Scheduled allocation'
      4. Ensure that Add self-assessments has a text value 'Self-assessment disabled'
      5. Save the form and revisit the scheduled allocation
      6. Ensure that the text is gone from the static field 'Add self-assessment'

            Unassigned Unassigned
            pavel.m.sokolov Pavel Sokolov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.