crmMailingAB - report.html - Fix reload after submitting final
authorTim Otten <totten@civicrm.org>
Thu, 19 Feb 2015 22:59:04 +0000 (14:59 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 19 Feb 2015 23:04:09 +0000 (15:04 -0800)
js/angular-crmMailingAB.js
js/angular-crmMailingAB/services.js

index cf48eb372f861aac5a1bec58552732c34c9522dd..1ef737a4f868705b0058036644783385feb4ae1c 100644 (file)
   angular.module('crmMailingAB').controller('CrmMailingABReportCtrl', function ($scope, crmApi, crmMailingStats) {
     var ts = $scope.ts = CRM.ts(null);
 
-    var activeMailingStatus = null, activeMailings = null;
+    var CrmMailingABReportCnt = 1, activeMailings = null;
     $scope.getActiveMailings = function() {
-      if ($scope.abtest.ab.status != activeMailingStatus) {
-        activeMailingStatus = $scope.abtest.ab.status;
+      if ($scope.abtest.$CrmMailingABReportCnt != CrmMailingABReportCnt) {
+        $scope.abtest.$CrmMailingABReportCnt = ++CrmMailingABReportCnt;
         activeMailings = [
           {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a, attachments: $scope.abtest.attachments.a},
           {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b, attachments: $scope.abtest.attachments.b}
         crmStatus({start: ts('Saving...'), success: ''}, abtest.save())
           .then(function () {
             return crmStatus({start: ts('Submitting...'), success: ts('Submitted')},
-              abtest.submitFinal().then(function(){
-                return abtest.load();
+              abtest.submitFinal().then(function(r){
+                delete abtest.$CrmMailingABReportCnt;
+                return r;
               }));
           })
           .then(function(){
index 3b6123fa8af219777056c2ef02467864321776c2..c9c14b9a56a47c8da98970182a111cd666f676b6 100644 (file)
         };
         return crmApi('MailingAB', 'submit', params)
           .then(function () {
-            return crmMailingAB;
+            return crmMailingAB.load();
           });
       },
       // @param mailing Object (per APIv3)