From 4a145a8ae596a00b60555df44d994184217160df Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 30 Oct 2017 16:44:01 +0100 Subject: [PATCH] MDL-60598 analytics: Info message for predictions based on data --- report/insights/classes/output/insights_list.php | 5 +++++ report/insights/lang/en/report_insights.php | 1 + report/insights/templates/insights_list.mustache | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/report/insights/classes/output/insights_list.php b/report/insights/classes/output/insights_list.php index 147721ca1d954..1ef320e9963c3 100644 --- a/report/insights/classes/output/insights_list.php +++ b/report/insights/classes/output/insights_list.php @@ -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(); diff --git a/report/insights/lang/en/report_insights.php b/report/insights/lang/en/report_insights.php index 3556d7639e9e7..68eab01fe96d5 100644 --- a/report/insights/lang/en/report_insights.php +++ b/report/insights/lang/en/report_insights.php @@ -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'; diff --git a/report/insights/templates/insights_list.mustache b/report/insights/templates/insights_list.mustache index 2c6c20082523f..b13137d858065 100644 --- a/report/insights/templates/insights_list.mustache +++ b/report/insights/templates/insights_list.mustache @@ -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", @@ -73,7 +76,14 @@ {{/modelselector}}

{{{insightname}}}

+ {{^noinsights}} +{{#nostaticmodelnotification}} +
+ {{> core/notification_info}} +
+{{/nostaticmodelnotification}} + {{{ pagingbar }}} {{#predictions}}