Commit 3f4202b6 authored by Robert Lyon's avatar Robert Lyon

Bug 1810862: Get progress for peer assessment working

Fixes the problems with 'peerassesment' option and also adds the
'verify' option

behatnotneeded

Change-Id: I6492057738fa35b1de7262ee19621795ea10b0c3
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent bfe7d688
......@@ -36,6 +36,10 @@ require_once('license.php');
class PluginArtefactAnnotation extends PluginArtefact {
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'annotation');
}
public static function get_artefact_types() {
return array(
'annotation',
......@@ -169,7 +173,7 @@ class PluginArtefactAnnotation extends PluginArtefact {
'name' => 'annotation',
'title' => get_string('placeannotation', 'artefact.annotation'),
'plugin' => 'annotation',
'active' => true,
'active' => get_field('blocktype_installed', 'active', 'name', 'annotation', 'artefactplugin', 'annotation'),
'iscountable' => true,
'is_metaartefact' => true,
),
......@@ -177,7 +181,7 @@ class PluginArtefactAnnotation extends PluginArtefact {
'name' => 'annotationfeedback',
'title' => get_string('placeannotationfeedback', 'artefact.annotation'),
'plugin' => 'annotation',
'active' => true,
'active' => get_field('blocktype_installed', 'active', 'name', 'annotation', 'artefactplugin', 'annotation'),
'iscountable' => true,
'is_metaartefact' => true,
)
......
......@@ -33,6 +33,10 @@ function valid_rating($ratingstr) {
class PluginArtefactComment extends PluginArtefact {
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'comment');
}
public static function get_artefact_types() {
return array(
'comment',
......@@ -144,7 +148,7 @@ class PluginArtefactComment extends PluginArtefact {
'name' => 'feedback',
'title' => get_string('addcomment', 'artefact.comment'),
'plugin' => 'comment',
'active' => true,
'active' => get_field('blocktype_installed', 'active', 'name', 'comment', 'artefactplugin', 'comment'),
'iscountable' => true,
'is_metaartefact' => true,
)
......
......@@ -15,6 +15,10 @@ require_once('file.php');
class PluginArtefactFile extends PluginArtefact {
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'file');
}
public static function get_artefact_types() {
return array(
'file',
......
......@@ -335,7 +335,7 @@ class PluginArtefactInternal extends PluginArtefact {
'name' => 'joingroup',
'title' => get_string('progressbaritem_joingroup', 'artefact.internal'),
'plugin' => 'internal',
'active' => true,
'active' => get_field('artefact_installed', 'active', 'name', 'internal'),
'iscountable' => true,
'is_metaartefact' => true,
),
......@@ -343,7 +343,7 @@ class PluginArtefactInternal extends PluginArtefact {
'name' => 'makefriend',
'title' => get_string('progressbaritem_makefriend', 'artefact.internal'),
'plugin' => 'internal',
'active' => true,
'active' => get_field('artefact_installed', 'active', 'name', 'internal'),
'iscountable' => true,
'is_metaartefact' => true,
)
......
......@@ -2105,6 +2105,9 @@ function artefact_get_progressbar_items($onlythese = false) {
}
$special->ismeta = true;
$artefactoptions[$special->name] = $special;
if (!$special->active) {
unset($artefactoptions[$special->name]);
}
}
}
......
......@@ -47,3 +47,13 @@ To see this peer assessment online, follow this link:
%s";
$string['typeassessmentfeedback'] = 'Peer assessment';
$string['nopeerassessmentrequired'] = 'You cannot see the content on this page because it does not require a peer assessment.';
$string['placeassessment'] = 'Place assessments';
$string['verifyassessment'] = 'Verify assessments';
$string['progress_peerassessment'] = array(
'Add 1 peer assessment to a page',
'Add %s peer assessments to pages',
);
$string['progress_verify'] = array(
"Give 1 verification to another user's peer assessment page",
"Give %s verifications to other users' peer assessment pages",
);
......@@ -16,6 +16,10 @@ require_once('license.php');
class PluginArtefactPeerassessment extends PluginArtefact {
public static function is_active() {
return get_field('artefact_installed', 'active', 'name', 'peerassessment');
}
public static function get_artefact_types() {
return array(
'peerassessment',
......@@ -118,6 +122,9 @@ class PluginArtefactPeerassessment extends PluginArtefact {
case 'peerassessment':
return 'view/index.php';
break;
case 'verify':
return 'view/index.php';
break;
}
}
......@@ -127,7 +134,15 @@ class PluginArtefactPeerassessment extends PluginArtefact {
'name' => 'peerassessment',
'title' => get_string('placeassessment', 'artefact.peerassessment'),
'plugin' => 'peerassessment',
'active' => true,
'active' => get_field('blocktype_installed', 'active', 'name', 'peerassessment', 'artefactplugin', 'peerassessment'),
'iscountable' => true,
'is_metaartefact' => true,
),
(object)array(
'name' => 'verify',
'title' => get_string('verifyassessment', 'artefact.peerassessment'),
'plugin' => 'peerassessment',
'active' => get_field('blocktype_installed', 'active', 'name', 'signoff', 'artefactplugin', 'peerassessment'),
'iscountable' => true,
'is_metaartefact' => true,
)
......@@ -143,12 +158,20 @@ class PluginArtefactPeerassessment extends PluginArtefact {
case 'peerassessment':
$sql = "SELECT COUNT(*) AS completed
FROM {artefact} a
JOIN {artefact_peer_assessment} ap ON ap.artefact = a.id
JOIN {artefact_peer_assessment} ap ON ap.assessment = a.id
WHERE a.artefacttype = 'peerassessment'
AND a.owner <> ?
AND ap.usr = ?";
$meta->completed = count_records_sql($sql, array($USER->get('id'), $USER->get('id')));
break;
case 'verify':
$sql = "SELECT COUNT(*) AS completed
FROM {view} v
JOIN {view_signoff_verify} vsv ON vsv.view = v.id
WHERE v.owner <> ?
AND vsv.verifier = ?";
$meta->completed = count_records_sql($sql, array($USER->get('id'), $USER->get('id')));
break;
default:
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment