Merge branch 'MDL-35073_master' of https://github.com/markn86/moodle
authorDamyon Wiese <damyon@moodle.com>
Fri, 5 Apr 2013 09:39:13 +0000 (17:39 +0800)
committerDamyon Wiese <damyon@moodle.com>
Fri, 5 Apr 2013 09:39:13 +0000 (17:39 +0800)
lib/db/install.xml
lib/db/upgrade.php
mod/assign/locallib.php

index 7c7eb5f..ce95ce0 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20130402" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20130405" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <KEY NAME="fk_badgeid" TYPE="foreign" FIELDS="badgeid" REFTABLE="badge" REFFIELDS="id"/>
       </KEYS>
       <INDEXES>
-        <INDEX NAME="badgeid" UNIQUE="false" FIELDS="badgeid"/>
         <INDEX NAME="criteriatype" UNIQUE="false" FIELDS="criteriatype"/>
         <INDEX NAME="badgecriteriatype" UNIQUE="true" FIELDS="badgeid, criteriatype"/>
       </INDEXES>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <KEY NAME="fk_critid" TYPE="foreign" FIELDS="critid" REFTABLE="badge_criteria" REFFIELDS="id"/>
       </KEYS>
-      <INDEXES>
-        <INDEX NAME="critid" UNIQUE="false" FIELDS="critid"/>
-      </INDEXES>
     </TABLE>
     <TABLE NAME="badge_issued" COMMENT="Defines issued badges">
       <FIELDS>
         <KEY NAME="fk_userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
       </KEYS>
       <INDEXES>
-        <INDEX NAME="badgeid" UNIQUE="false" FIELDS="badgeid"/>
-        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
         <INDEX NAME="badgeuser" UNIQUE="true" FIELDS="badgeid, userid"/>
       </INDEXES>
     </TABLE>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
-        <KEY NAME="fk_badgeid" TYPE="foreign" FIELDS="id" REFTABLE="badge" REFFIELDS="id"/>
+        <KEY NAME="fk_badgeid" TYPE="foreign" FIELDS="badgeid" REFTABLE="badge" REFFIELDS="id"/>
         <KEY NAME="fk_recipientid" TYPE="foreign" FIELDS="recipientid" REFTABLE="user" REFFIELDS="id"/>
         <KEY NAME="fk_issuerid" TYPE="foreign" FIELDS="issuerid" REFTABLE="user" REFFIELDS="id"/>
         <KEY NAME="fk_issuerrole" TYPE="foreign" FIELDS="issuerrole" REFTABLE="role" REFFIELDS="id"/>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
         <KEY NAME="fk_userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
       </KEYS>
-      <INDEXES>
-        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
-      </INDEXES>
     </TABLE>
   </TABLES>
 </XMLDB>
index d0b1be9..52a0839 100644 (file)
@@ -1843,7 +1843,6 @@ function xmldb_main_upgrade($oldversion) {
         $table->add_key('fk_badgeid', XMLDB_KEY_FOREIGN, array('badgeid'), 'badge', array('id'));
 
         // Adding indexes to table 'badge_criteria'.
-        $table->add_index('badgeid', XMLDB_INDEX_NOTUNIQUE, array('badgeid'));
         $table->add_index('criteriatype', XMLDB_INDEX_NOTUNIQUE, array('criteriatype'));
         $table->add_index('badgecriteriatype', XMLDB_INDEX_UNIQUE, array('badgeid', 'criteriatype'));
 
@@ -1865,9 +1864,6 @@ function xmldb_main_upgrade($oldversion) {
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
         $table->add_key('fk_critid', XMLDB_KEY_FOREIGN, array('critid'), 'badge_criteria', array('id'));
 
-        // Adding indexes to table 'badge_criteria_param'.
-        $table->add_index('critid', XMLDB_INDEX_NOTUNIQUE, array('critid'));
-
         // Conditionally launch create table for 'badge_criteria_param'.
         if (!$dbman->table_exists($table)) {
             $dbman->create_table($table);
@@ -1891,9 +1887,6 @@ function xmldb_main_upgrade($oldversion) {
         $table->add_key('fk_badgeid', XMLDB_KEY_FOREIGN, array('badgeid'), 'badge', array('id'));
         $table->add_key('fk_userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 
-        // Adding indexes to table 'badge_issued'.
-        $table->add_index('badgeid', XMLDB_INDEX_NOTUNIQUE, array('badgeid'));
-        $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
         $table->add_index('badgeuser', XMLDB_INDEX_UNIQUE, array('badgeid', 'userid'));
 
         // Conditionally launch create table for 'badge_issued'.
@@ -1935,7 +1928,7 @@ function xmldb_main_upgrade($oldversion) {
 
         // Adding keys to table 'badge_manual_award'.
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-        $table->add_key('fk_badgeid', XMLDB_KEY_FOREIGN, array('id'), 'badge', array('id'));
+        $table->add_key('fk_badgeid', XMLDB_KEY_FOREIGN, array('badgeid'), 'badge', array('id'));
         $table->add_key('fk_recipientid', XMLDB_KEY_FOREIGN, array('recipientid'), 'user', array('id'));
         $table->add_key('fk_issuerid', XMLDB_KEY_FOREIGN, array('issuerid'), 'user', array('id'));
         $table->add_key('fk_issuerrole', XMLDB_KEY_FOREIGN, array('issuerrole'), 'role', array('id'));
@@ -1962,9 +1955,6 @@ function xmldb_main_upgrade($oldversion) {
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
         $table->add_key('fk_userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 
-        // Adding indexes to table 'badge_backpack'.
-        $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
-
         // Conditionally launch create table for 'badge_backpack'.
         if (!$dbman->table_exists($table)) {
             $dbman->create_table($table);
index 5cf0de7..1c44529 100644 (file)
@@ -3300,7 +3300,7 @@ class assign {
             if ($teamsubmission && ($teamsubmission->status != ASSIGN_SUBMISSION_STATUS_DRAFT)) {
                 $showsubmit = false;
             }
-            if ($submission && ($submission->status != ASSIGN_SUBMISSION_STATUS_SUBMITTED)) {
+            if ($submission && ($submission->status != ASSIGN_SUBMISSION_STATUS_DRAFT)) {
                 $showsubmit = false;
             }
             if (!$this->get_instance()->submissiondrafts) {