From 05aaa6ae844d88586e125b5f984f66e7c642b8e2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 17 Feb 2015 17:30:09 -0800 Subject: [PATCH] CRM-15970 - crmMailingAB - Use new testing_criteria and winner_criteria fields --- js/angular-crmMailingAB.js | 18 +++++------------- js/angular-crmMailingAB/services.js | 10 +++++----- partials/crmMailingAB/edit.html | 10 +++++----- partials/crmMailingAB/list.html | 8 ++++---- partials/crmMailingAB/setup.html | 2 +- 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index c5861d45ff..0cacb6c974 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -84,18 +84,17 @@ abtest.mailings.b.name = ts('Test B (%1)', {1: abtest.ab.name}); abtest.mailings.c.name = ts('Winner (%1)', {1: abtest.ab.name}); - var criteria = crmMailingABCriteria.get(abtest.ab.testing_criteria_id); - if (criteria) { + if (abtest.ab.testing_criteria) { // TODO review fields exposed in UI and make sure the sync rules match - switch (criteria.name) { - case 'Subject lines': + switch (abtest.ab.testing_criteria) { + case 'subject': crmMailingMgr.mergeInto(abtest.mailings.b, abtest.mailings.a, [ 'name', 'recipients', 'subject' ]); break; - case 'From names': + case 'from': crmMailingMgr.mergeInto(abtest.mailings.b, abtest.mailings.a, [ 'name', 'recipients', @@ -103,7 +102,7 @@ 'from_email' ]); break; - case 'Two different emails': + case 'full_email': crmMailingMgr.mergeInto(abtest.mailings.b, abtest.mailings.a, [ 'name', 'recipients', @@ -166,14 +165,7 @@ $location.replace(); }; - function updateCriteriaName() { - var criteria = crmMailingABCriteria.get($scope.abtest.ab.testing_criteria_id); - $scope.criteriaName = criteria ? criteria.name : null; - } - // initialize - updateCriteriaName(); - $scope.$watch('abtest.ab.testing_criteria_id', updateCriteriaName); var syncJob = $interval($scope.sync, 333); $scope.$on('$destroy', function(){ $interval.cancel(syncJob); diff --git a/js/angular-crmMailingAB/services.js b/js/angular-crmMailingAB/services.js index 04c1e480a4..955ba954ce 100644 --- a/js/angular-crmMailingAB/services.js +++ b/js/angular-crmMailingAB/services.js @@ -17,9 +17,9 @@ angular.module('crmMailingAB').factory('crmMailingABCriteria', function () { // TODO Get data from server var values = { - '1': {value: '1', name: 'Subject lines', label: ts('Test different "Subject" lines')}, - '2': {value: '2', name: 'From names', label: ts('Test different "From" lines')}, - '3': {value: '3', name: 'Two different emails', label: ts('Test entirely different emails')} + '1': {value: 'subject', name: 'subject', label: ts('Test different "Subject" lines')}, + '2': {value: 'from', name: 'from', label: ts('Test different "From" lines')}, + '3': {value: 'full_email', name: 'full_email', label: ts('Test entirely different emails')} }; return new OptionGroup(values); }); @@ -70,8 +70,8 @@ mailing_id_b: null, mailing_id_c: null, domain_id: null, - testing_criteria_id: 1, // FIXME - winner_criteria_id: null, + testing_criteria: 'subject', + winner_criteria: null, specific_url: '', declare_winning_time: null, group_percentage: 10 diff --git a/partials/crmMailingAB/edit.html b/partials/crmMailingAB/edit.html index ee1af5c667..aafb88fb6c 100644 --- a/partials/crmMailingAB/edit.html +++ b/partials/crmMailingAB/edit.html @@ -34,11 +34,11 @@ }" crm-abtest="abtest"> -
+
-
+
-
+
- - + @@ -31,7 +31,7 @@ Required vars: mailingABList {{ts('Name')}} {{ts('Status')}} - {{ts('Test Type')}} + {{ts('Test Type')}} {{ts('Created')}} @@ -40,7 +40,7 @@ Required vars: mailingABList {{mailingAB.name}} {{crmMailingABStatus.getByName(mailingAB.status).label}} - {{crmMailingABCriteria.get(mailingAB.testing_criteria_id).label}} + {{crmMailingABCriteria.get(mailingAB.testing_criteria).label}} {{mailingAB.created_date}} {{ts('Continue')}} diff --git a/partials/crmMailingAB/setup.html b/partials/crmMailingAB/setup.html index 1778057e35..2b15e66ca5 100644 --- a/partials/crmMailingAB/setup.html +++ b/partials/crmMailingAB/setup.html @@ -29,7 +29,7 @@
-- 2.25.1