Skip to content

Commit

Permalink
MDL-66091 report_insights: Usability improvements
Browse files Browse the repository at this point in the history
- More feedback provided for the user once they click on useful/notuseful from the email.
- Replace the indicator calculations table headers for the table caption and
  replace the text by just "Indicators"
- Replace "System" for the site name for insights generated at system
  level
- Replace "$modelname prediction" for "$modelname" in report/insights/prediction.php
  heading

MDL-66091
  • Loading branch information
David Monllaó committed Sep 17, 2019
1 parent 1c3efe4 commit 2120209
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
3 changes: 2 additions & 1 deletion analytics/classes/insights_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ private function prediction_info(\core_analytics\prediction $prediction) {
$actionurl = $action->get_url();
if (!$actionurl->get_param('forwardurl')) {

$actiondoneurl = new \moodle_url('/report/insights/done.php');
$params = ['actionvisiblename' => $action->get_text(), 'target' => '_blank'];
$actiondoneurl = new \moodle_url('/report/insights/done.php', $params);
// Set the forward url to the 'done' script.
$actionurl->param('forwardurl', $actiondoneurl->out(false));
}
Expand Down
17 changes: 15 additions & 2 deletions report/insights/done.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,18 @@

require_login();

$url = new \moodle_url('/');
redirect($url, get_string('actionsaved', 'report_insights'), null, \core\output\notification::NOTIFY_SUCCESS);
$actionvisiblename = required_param('actionvisiblename', PARAM_NOTAGS);

$PAGE->set_pagelayout('popup');
$PAGE->set_context(\context_system::instance());
$PAGE->set_title(get_site()->fullname);
$PAGE->set_url(new \moodle_url('/report/insights/done.php'));

echo $OUTPUT->header();

$notification = new \core\output\notification(get_string('actionsaved', 'report_insights', $actionvisiblename),
\core\output\notification::NOTIFY_SUCCESS);
$notification->set_show_closebutton(false);
echo $OUTPUT->render($notification);

echo $OUTPUT->footer();
6 changes: 5 additions & 1 deletion report/insights/insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,12 @@
exit(0);
}

if ($context->id == SYSCONTEXTID) {
$PAGE->set_heading(get_site()->shortname);
} else {
$PAGE->set_heading($insightinfo->contextname);
}
$PAGE->set_title($insightinfo->insightname);
$PAGE->set_heading($insightinfo->contextname);

// Some models generate one single prediction per context. We can directly show the prediction details in this case.
if ($model->get_analyser()::one_sample_per_analysable()) {
Expand Down
7 changes: 2 additions & 5 deletions report/insights/lang/en/report_insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['actionsaved'] = 'Your action has been saved.';
$string['calculatedvalue'] = 'Calculated value';
$string['actionsaved'] = 'Your feedback of \'{$a}\' has been saved.';
$string['disabledmodel'] = 'Sorry, this model has been disabled by the administrator';
$string['indicator'] = 'Indicator';
$string['insightprediction'] = '{$a} prediction';
$string['indicators'] = 'Indicators';
$string['insight'] = 'Insight';
$string['insights'] = 'Insights';
$string['justpredictions'] = 'Please note that the following insights are only predictions. It is not possible to predict the future with any certainty. The insights are provided so that action can be taken as necessary to prevent any negative predictions becoming reality.';
Expand All @@ -39,7 +37,6 @@
$string['outcomeverynegative'] = 'Very negative outcome';
$string['pluginname'] = 'Insights';
$string['prediction'] = 'Prediction';
$string['predictioncalculations'] = 'Indicator calculations';
$string['predictiondetails'] = 'Prediction details';
$string['nodetailsavailable'] = 'No prediction details are relevant.';
$string['timecreated'] = 'Time predicted';
Expand Down
6 changes: 5 additions & 1 deletion report/insights/prediction.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@
exit(0);
}

if ($context->id == SYSCONTEXTID) {
$PAGE->set_heading(get_site()->shortname);
} else {
$PAGE->set_heading($insightinfo->contextname);
}
$PAGE->set_title($insightinfo->insightname);
$PAGE->set_heading($insightinfo->contextname);

echo $OUTPUT->header();

Expand Down
16 changes: 5 additions & 11 deletions report/insights/templates/insight_details.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}
}}

<h2 class="mb-2">{{#str}}insightprediction, report_insights, {{insightname}} {{/str}}</h2>
<h2 class="mb-2">{{insightname}}</h2>
<table class="generaltable insights-list">
{{#showpredicionheading}}
<caption>
Expand Down Expand Up @@ -101,29 +101,23 @@
<caption>{{#str}}predictiondetails, report_insights{{/str}}</caption>
<tbody>
<tr>
<td scope="row">{{#str}}timecreated, report_insights{{/str}}</td>
<th scope="row">{{#str}}timecreated, report_insights{{/str}}</td>
<td>{{timecreated}}</td>
</tr>
{{#timerange}}
<tr>
<td scope="row">{{#str}}timerange, report_insights{{/str}}</td>
<th scope="row">{{#str}}timerange, report_insights{{/str}}</td>
<td>{{.}}</td>
</tr>
{{/timerange}}
</tbody>
</table>
<table class="generaltable prediction-calculations">
<caption class="accesshide">{{#str}}predictioncalculations, report_insights{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}indicator, report_insights{{/str}}</th>
<th scope="col">{{#str}}calculatedvalue, report_insights{{/str}}</th>
</tr>
</thead>
<caption>{{#str}}indicators, report_insights{{/str}}</caption>
<tbody>
{{#calculations}}
<tr>
<td class="{{#style}}table-{{style}}{{/style}}">{{name}}</td>
<th scope="row" class="{{#style}}table-{{style}}{{/style}}">{{name}}</td>
<td class="{{#style}}table-{{style}}{{/style}}">{{#outcomeicon}}{{> core/pix_icon}}{{/outcomeicon}} {{displayvalue}}</td>
</tr>
{{/calculations}}
Expand Down

0 comments on commit 2120209

Please sign in to comment.