/**
  * This function tests to see that the threshold gets correctly stored and retrieved
  * in the class.
  */
 public function test_get_threshold()
 {
     $sgs = new skills_group_setting($this->courseid);
     // Test threshold setting (defaults to 1).
     $sgs->update_record($this->get_skills_group_settings());
     $this->assertEquals($sgs->get_threshold(), 1);
 }
global $OUTPUT, $PAGE, $USER;
$courseid = required_param('courseid', PARAM_INT);
if (!blocks_skills_group_verify_access('block/skills_group:canmanageskillsgroups', true)) {
    redirect(new moodle_url('/course/view.php', array('id' => $courseid)));
}
$url = new moodle_url('/blocks/skills_group/edit_skills_group_settings.php', array('id' => $courseid, 'sesskey' => $USER->sesskey));
block_skills_group_setup_page($courseid, $url, get_string('editsettingstitle', BLOCK_SG_LANG_TABLE));
$editform = new edit_skills_group_settings_form($courseid);
$toform['courseid'] = $courseid;
// Retrieve any previously used settings.
$sgs = new skills_group_setting($courseid);
if ($sgs->exists()) {
    $toform['feedbacks'] = $sgs->get_feedback_id();
    $toform['groupings'] = $sgs->get_grouping_id();
    $toform['maxsize'] = $sgs->get_group_size();
    $toform['threshold'] = $sgs->get_threshold();
    $toform['allownaming'] = $sgs->get_allownaming();
    if ($sgs->date_restriction()) {
        $toform['datecheck'] = 1;
        $toform['date'] = $sgs->get_date();
    } else {
        $toform['datecheck'] = 0;
        $toform['date'] = null;
    }
}
$editform->set_data($toform);
if ($editform->is_cancelled()) {
    $courseurl = new moodle_url('/course/view.php', array('id' => $courseid));
    redirect($courseurl);
} else {
    if ($fromform = $editform->get_data()) {