MDL-58835 report_insights: Force window reload when no more predictions
authorDavid Monllao <davidm@moodle.com>
Thu, 14 Sep 2017 10:55:03 +0000 (12:55 +0200)
committerDavid Monllao <davidm@moodle.com>
Thu, 14 Sep 2017 10:55:03 +0000 (12:55 +0200)
report/insights/amd/build/actions.min.js
report/insights/amd/src/actions.js

index 431a58b..71cc939 100644 (file)
Binary files a/report/insights/amd/build/actions.min.js and b/report/insights/amd/build/actions.min.js differ
index bc10ce2..3c98868 100644 (file)
@@ -57,7 +57,11 @@ define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notificat
 
                         // Move back if no remaining predictions.
                         if ($('.insights-list tr').length < 2) {
-                            window.history.back();
+                            if (document.referrer) {
+                                window.location.assign(document.referrer);
+                            } else {
+                                window.location.reload(true);
+                            }
                         }
                     }).fail(Notification.exception);
                 }