Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NOBUG workshop: added field evaluation for future usage
The field holds the name of the grading evaluation method recently used
for the workshop or the default one to be used. At the moment there are
no alternatives but 'best' plugin. But I want to have the field there
before 2.0 stable release and also want to include it in workshop
backups.
  • Loading branch information
mudrd8mz committed Jul 7, 2010
1 parent 32d2dda commit c2d2eb6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
7 changes: 4 additions & 3 deletions mod/workshop/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/workshop/db" VERSION="20091218" COMMENT="XMLDB file for Moodle mod/workshop"
<XMLDB PATH="mod/workshop/db" VERSION="20100707" COMMENT="XMLDB file for Moodle mod/workshop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand All @@ -22,8 +22,9 @@
<FIELD NAME="useselfassessment" TYPE="int" LENGTH="2" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="optional feature: students perform self assessment of their own work" PREVIOUS="usepeerassessment" NEXT="grade"/>
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="80" SEQUENCE="false" DECIMALS="5" COMMENT="The maximum grade for submission" PREVIOUS="useselfassessment" NEXT="gradinggrade"/>
<FIELD NAME="gradinggrade" TYPE="number" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="20" SEQUENCE="false" DECIMALS="5" COMMENT="The maximum grade for assessment" PREVIOUS="grade" NEXT="strategy"/>
<FIELD NAME="strategy" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="The type of the current grading strategy used in this workshop" PREVIOUS="gradinggrade" NEXT="gradedecimals"/>
<FIELD NAME="gradedecimals" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Number of digits that should be shown after the decimal point when displaying grades" PREVIOUS="strategy" NEXT="nattachments"/>
<FIELD NAME="strategy" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="The type of the current grading strategy used in this workshop" PREVIOUS="gradinggrade" NEXT="evaluation"/>
<FIELD NAME="evaluation" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" COMMENT="The recently used grading evaluation method" PREVIOUS="strategy" NEXT="gradedecimals"/>
<FIELD NAME="gradedecimals" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Number of digits that should be shown after the decimal point when displaying grades" PREVIOUS="evaluation" NEXT="nattachments"/>
<FIELD NAME="nattachments" TYPE="int" LENGTH="3" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Number of required submission attachments" PREVIOUS="gradedecimals" NEXT="latesubmissions"/>
<FIELD NAME="latesubmissions" TYPE="int" LENGTH="2" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allow submitting the work after the deadline" PREVIOUS="nattachments" NEXT="maxbytes"/>
<FIELD NAME="maxbytes" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="100000" SEQUENCE="false" COMMENT="Maximum size of the one attached file" PREVIOUS="latesubmissions" NEXT="examplesmode"/>
Expand Down
20 changes: 20 additions & 0 deletions mod/workshop/db/upgrade.php
Expand Up @@ -215,5 +215,25 @@ function xmldb_workshop_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2009121800, 'workshop');
}

/**
* Add 'evaluation' field into workshop
*/
if ($oldversion < 2010070700) {
$table = new xmldb_table('workshop');
$field = new xmldb_field('evaluation', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null, 'strategy');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2010070700, 'workshop');
}

/**
* Set the value of the new 'evaluation' field to 'best', there is no alternative at the moment
*/
if ($oldversion < 2010070701) {
$DB->set_field('workshop', 'evaluation', 'best');
upgrade_mod_savepoint(true, 2010070701, 'workshop');
}

return true;
}
2 changes: 2 additions & 0 deletions mod/workshop/lib.php
Expand Up @@ -72,6 +72,7 @@ function workshop_add_instance(stdclass $workshop) {
$workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); // unticked checkbox hack
$workshop->useselfassessment = (int)!empty($workshop->useselfassessment); // unticked checkbox hack
$workshop->latesubmissions = (int)!empty($workshop->latesubmissions); // unticked checkbox hack
$workshop->evaluation = 'best';

// insert the new record so we get the id
$workshop->id = $DB->insert_record('workshop', $workshop);
Expand Down Expand Up @@ -121,6 +122,7 @@ function workshop_update_instance(stdclass $workshop) {
$workshop->usepeerassessment = (int)!empty($workshop->usepeerassessment); // unticked checkbox hack
$workshop->useselfassessment = (int)!empty($workshop->useselfassessment); // unticked checkbox hack
$workshop->latesubmissions = (int)!empty($workshop->latesubmissions); // unticked checkbox hack
$workshop->evaluation = 'best';

// todo - if the grading strategy is being changed, we must replace all aggregated peer grades with nulls
// todo - if maximum grades are being changed, we should probably recalculate or invalidate them
Expand Down
6 changes: 3 additions & 3 deletions mod/workshop/locallib.php
Expand Up @@ -115,6 +115,9 @@ class workshop {
/** @var string type of the current grading strategy used in this workshop, for example 'accumulative' */
public $strategy;

/** @var string the name of the evaluation plugin to use for grading grades calculation */
public $evaluation;

/** @var int number of digits that should be shown after the decimal point when displaying grades */
public $gradedecimals;

Expand Down Expand Up @@ -142,9 +145,6 @@ class workshop {
/** @var int if greater than 0 then the peer assessment is not allowed after this timestamp */
public $assessmentend;

/** @var string the name of the evaluation plugin to use for grading grades calculation */
public $evaluation;

/**
* @var workshop_strategy grading strategy instance
* Do not use directly, get the instance using {@link workshop::grading_strategy_instance()}
Expand Down
4 changes: 2 additions & 2 deletions mod/workshop/version.php
Expand Up @@ -28,6 +28,6 @@

defined('MOODLE_INTERNAL') || die();

$module->version = 2009121800;
$module->requires = 2009090400; // Requires this Moodle version
$module->version = 2010070701;
$module->requires = 2010070604; // Requires this Moodle version
//$module->cron = 60;

0 comments on commit c2d2eb6

Please sign in to comment.