Skip to content

Commit

Permalink
MDL-60598 analytics: Info message for predictions based on data
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Nov 3, 2017
1 parent 159b4e5 commit 4a145a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions report/insights/classes/output/insights_list.php
Expand Up @@ -95,6 +95,11 @@ public function export_for_template(\renderer_base $output) {
if ($this->model->uses_insights()) {
$predictionsdata = $this->model->get_predictions($this->context, true, $this->page, $this->perpage);

if (!$this->model->is_static()) {
$notification = new \core\output\notification(get_string('justpredictions', 'report_insights'));
$data->nostaticmodelnotification = $notification->export_for_template($output);
}

$data->predictions = array();
$predictionvalues = array();
$insights = array();
Expand Down
1 change: 1 addition & 0 deletions report/insights/lang/en/report_insights.php
Expand Up @@ -28,6 +28,7 @@
$string['insightprediction'] = '{$a} prediction';
$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.';
$string['outcome'] = 'Outcome';
$string['outcomenegative'] = 'Negative outcome';
$string['outcomeneutral'] = 'Neutral outcome';
Expand Down
10 changes: 10 additions & 0 deletions report/insights/templates/insights_list.mustache
Expand Up @@ -31,6 +31,9 @@
Example context (json):
{
"insightname": "Best insight ever",
"nostaticmodelnotification": {
"message": "This is just a prediction."
},
"predictions": [
{
"predictiondisplayvalue": "This dev will understand it",
Expand Down Expand Up @@ -73,7 +76,14 @@
{{/modelselector}}

<h2 class="m-b-2">{{{insightname}}}</h2>

{{^noinsights}}
{{#nostaticmodelnotification}}
<div class="m-t-2">
{{> core/notification_info}}
</div>
{{/nostaticmodelnotification}}

{{{ pagingbar }}}
{{#predictions}}
<table class="generaltable insights-list">
Expand Down

0 comments on commit 4a145a8

Please sign in to comment.