Skip to content

Commit

Permalink
MDL-66628 tool_analytics: Effectiveness report to insights report
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllaó committed Sep 27, 2019
1 parent 9528b1f commit 4463a4a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Expand Up @@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Effectiveness report renderable.
* Insights report renderable.
*
* @package tool_analytics
* @copyright 2019 David Monllao {@link http://www.davidmonllao.com}
Expand All @@ -27,13 +27,13 @@
defined('MOODLE_INTERNAL') || die;

/**
* Effectiveness report renderable.
* Insights report renderable.
*
* @package tool_analytics
* @copyright 2019 David Monllao {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class effectiveness_report implements \renderable, \templatable {
class insights_report implements \renderable, \templatable {

/**
* @var \core_analytics\model
Expand All @@ -46,7 +46,7 @@ class effectiveness_report implements \renderable, \templatable {
private $context = null;

/**
* Inits the effectiveness report renderable.
* Inits the insights report renderable.
*
* @param \core_analytics\model $model
* @param int|null $contextid
Expand Down Expand Up @@ -79,7 +79,7 @@ public function export_for_template(\renderer_base $output): \stdClass {
$predictioncontexts = $this->model->get_predictions_contexts(false);
if ($predictioncontexts && count($predictioncontexts) > 1) {
$url = new \moodle_url('/admin/tool/analytics/model.php', ['id' => $this->model->get_id(),
'action' => 'effectivenessreport']);
'action' => 'insightsreport']);

if ($this->context) {
$selected = $this->context->id;
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/analytics/classes/output/models_list.php
Expand Up @@ -288,12 +288,12 @@ public function export_for_template(\renderer_base $output) {
}
}

// Effectivity report.
// Insights report.
if (!empty($anypredictionobtained) && $model->uses_insights()) {
$urlparams['action'] = 'effectivenessreport';
$urlparams['action'] = 'insightsreport';
$url = new \moodle_url('/admin/tool/analytics/model.php', $urlparams);
$pix = new \pix_icon('i/report', get_string('effectivenessreport', 'tool_analytics'));
$icon = new \action_menu_link_secondary($url, $pix, get_string('effectivenessreport', 'tool_analytics'));
$pix = new \pix_icon('i/report', get_string('insightsreport', 'tool_analytics'));
$icon = new \action_menu_link_secondary($url, $pix, get_string('insightsreport', 'tool_analytics'));
$actionsmenu->add($icon);
}

Expand Down
8 changes: 4 additions & 4 deletions admin/tool/analytics/classes/output/renderer.php
Expand Up @@ -211,12 +211,12 @@ public function render_get_predictions_results($trainresults = false, $trainlogs
/**
* Defer to template.
*
* @param \tool_analytics\output\effectiveness_report $effectivenessreport
* @param \tool_analytics\output\insights_report $insightsreport
* @return string HTML
*/
protected function render_effectiveness_report(\tool_analytics\output\effectiveness_report $effectivenessreport): string {
$data = $effectivenessreport->export_for_template($this);
return parent::render_from_template('tool_analytics/effectiveness_report', $data);
protected function render_insights_report(\tool_analytics\output\insights_report $insightsreport): string {
$data = $insightsreport->export_for_template($this);
return parent::render_from_template('tool_analytics/insights_report', $data);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/analytics/lang/en/tool_analytics.php
Expand Up @@ -25,6 +25,7 @@
$string['accuracy'] = 'Accuracy';
$string['actions'] = 'Actions';
$string['actionsexecutedbyusers'] = 'Actions executed by users';
$string['actionsexecutedbyusersfor'] = 'Actions executed by users for "{$a}" model';
$string['actionexecutedgroupedusefulness'] = 'Grouped actions';
$string['allpredictions'] = 'All predictions';
$string['alltimesplittingmethods'] = 'All analysis intervals';
Expand All @@ -51,8 +52,6 @@
$string['disabled'] = 'Disabled';
$string['editmodel'] = 'Edit "{$a}" model';
$string['edittrainedwarning'] = 'This model has already been trained. Note that changing its indicators or its analysis interval will delete its previous predictions and start generating new predictions.';
$string['effectivenessreport'] = 'Effectiveness report';
$string['effectivenessreportfor'] = 'Model "{$a}" effectiveness';
$string['enabled'] = 'Enabled';
$string['errorcantenablenotimesplitting'] = 'You need to select an analysis interval before enabling the model';
$string['errornoenabledandtrainedmodels'] = 'There are no enabled and trained models to predict.';
Expand Down Expand Up @@ -91,6 +90,7 @@
$string['indicators_link'] = 'Indicators';
$string['indicatorsnum'] = 'Number of indicators: {$a}';
$string['info'] = 'Info';
$string['insightsreport'] = 'Insights report';
$string['ignoreversionmismatches'] = 'Ignore version mismatches';
$string['ignoreversionmismatchescheckbox'] = 'Ignore the differences between this site version and the original site version.';
$string['importedsuccessfully'] = 'The model has been successfully imported.';
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/analytics/model.php
Expand Up @@ -69,8 +69,8 @@
case 'clear':
$title = get_string('clearpredictions', 'tool_analytics');
break;
case 'effectivenessreport':
$title = get_string('effectivenessreport', 'tool_analytics');
case 'insightsreport':
$title = get_string('insightsreport', 'tool_analytics');
break;
case 'invalidanalysables':
$title = get_string('invalidanalysables', 'tool_analytics');
Expand Down Expand Up @@ -282,13 +282,13 @@
redirect($returnurl);
break;

case 'effectivenessreport':
case 'insightsreport':

$contextid = optional_param('contextid', null, PARAM_INT);

echo $OUTPUT->header();

$renderable = new \tool_analytics\output\effectiveness_report($model, $contextid);
$renderable = new \tool_analytics\output\insights_report($model, $contextid);
$renderer = $PAGE->get_renderer('tool_analytics');
echo $renderer->render($renderable);

Expand Down
Expand Up @@ -15,9 +15,9 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template tool_analytics/effectiveness_report
@template tool_analytics/insights_report
Template for the effectiveness report.
Template for the insights report.
Classes required for JS:
* none
Expand All @@ -39,7 +39,7 @@
}}

<div class="box">
<h3>{{#str}}effectivenessreportfor, tool_analytics, {{modelname}}{{/str}}</h3>
<h3>{{#str}}actionsexecutedbyusersfor, tool_analytics, {{modelname}}{{/str}}</h3>

{{#contextselect}}
<div class="mt-3">
Expand Down

0 comments on commit 4463a4a

Please sign in to comment.