Skip to content

Commit e55015c

Browse files
Merge down release hotfixes 5.0 into 5.1 (#1470)
* cherry-pick ea63855 (#1159) Co-authored-by: pratik <ppratik.cr7@gmail.com> * Hotfix/enrollment complete fix (#1161) * cherry-pick ea63855 * bump version after enrollment complete hotfix --------- Co-authored-by: pratik <ppratik.cr7@gmail.com> * Fix/version root only (#1163) * revert, change version back to major-minor on root only * add backend * Fix/version root only (#1164) * revert, change version back to major-minor on root only * add backend * commit the backend package.json * no assignedCondition null in java lib (#1441) * fix missing imports * version bump 5.1.10 --------- Co-authored-by: pratik <ppratik.cr7@gmail.com>
1 parent 484f0c6 commit e55015c

18 files changed

Lines changed: 45 additions & 29 deletions

File tree

backend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ab_testing_backend",
3-
"version": "5.1.9",
3+
"version": "5.1.10",
44
"description": "Backend for A/B Testing Project",
55
"scripts": {
66
"install:all": "npm ci && cd packages/Scheduler && npm ci && cd ../Upgrade && npm ci",

backend/packages/Scheduler/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/packages/Scheduler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ppl-upgrade-serverless",
3-
"version": "5.1.9",
3+
"version": "5.1.10",
44
"description": "Serverless webpack example using Typescript",
55
"main": "handler.js",
66
"scripts": {

backend/packages/Upgrade/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/packages/Upgrade/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ab_testing_backend",
3-
"version": "5.1.9",
3+
"version": "5.1.10",
44
"description": "Backend for A/B Testing Project",
55
"main": "index.js",
66
"scripts": {

backend/packages/Upgrade/src/api/repositories/ExperimentRepository.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ export class ExperimentRepository extends Repository<Experiment> {
112112

113113
public async getValidExperiments(context: string): Promise<Experiment[]> {
114114
const whereExperimentsClause =
115-
'(experiment.state = :enrolling OR experiment.state = :enrollmentComplete) AND :context ILIKE ANY (ARRAY[experiment.context])';
115+
'(experiment.state = :enrolling OR experiment.state = :enrollmentComplete) AND NOT (experiment.state = :enrollmentComplete AND experiment.postExperimentRule = :assign AND experiment.revertTo IS NULL) AND :context ILIKE ANY (ARRAY[experiment.context])';
116116
const whereClauseParams = {
117117
enrolling: 'enrolling',
118118
enrollmentComplete: 'enrollmentComplete',
119+
assign: 'assign',
119120
context,
120121
};
121122
const experimentConditionLevelPayloadQuery = this.createQueryBuilder('experiment')
@@ -210,11 +211,12 @@ export class ExperimentRepository extends Repository<Experiment> {
210211

211212
public async getValidExperimentsWithPreview(context: string): Promise<Experiment[]> {
212213
const whereExperimentsClause =
213-
'(experiment.state = :enrolling OR experiment.state = :enrollmentComplete OR experiment.state = :preview) AND :context ILIKE ANY (ARRAY[experiment.context])';
214+
'(experiment.state = :enrolling OR experiment.state = :enrollmentComplete OR experiment.state = :preview) AND NOT (experiment.state = :enrollmentComplete AND experiment.postExperimentRule = :assign AND experiment.revertTo IS NULL) AND :context ILIKE ANY (ARRAY[experiment.context])';
214215
const whereClauseParams = {
215216
enrolling: 'enrolling',
216217
enrollmentComplete: 'enrollmentComplete',
217218
preview: 'preview',
219+
assign: 'assign',
218220
context,
219221
};
220222
const experimentConditionLevelPayloadQuery = this.createQueryBuilder('experiment')

clientlibs/java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
at the same time that happen to rev to the same new version will be caught
1010
by a merge conflict. -->
1111

12-
<version>5.1.9</version>
12+
<version>5.1.10</version>
1313
<build>
1414
<plugins>
1515
<plugin>

clientlibs/java/src/main/java/org/upgradeplatform/client/Main.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ public void onSuccess(@NonNull Assignment expResult){
8181

8282
System.out.println("code");
8383
System.out.println(code);
84-
MarkExperimentRequestData markData = new MarkExperimentRequestData(site, target);
85-
experimentClient.markDecisionPoint(MarkedDecisionPointStatus.CONDITION_APPLIED, markData, "", new Date().toString(), new ResponseCallback<MarkDecisionPoint>(){
84+
MarkExperimentRequestData data = new MarkExperimentRequestData(site, target, null);
85+
System.out.println(data.getAssignedCondition());
86+
87+
experimentClient.markDecisionPoint(MarkedDecisionPointStatus.CONDITION_APPLIED, data, new ResponseCallback<MarkDecisionPoint>(){
8688
@Override
8789
public void onSuccess(@NonNull MarkDecisionPoint markResult){
8890
result.complete("marked " + code + ": " + markResult.toString());

clientlibs/java/src/main/java/org/upgradeplatform/requestbeans/MarkExperimentRequestData.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package org.upgradeplatform.requestbeans;
22

3+
import java.util.Map;
4+
35
import org.upgradeplatform.responsebeans.Condition;
6+
import org.upgradeplatform.responsebeans.Factor;
47

58
public class MarkExperimentRequestData {
69

710
private String site;
811
private String target;
9-
private Condition assignedCondition;
12+
private Condition assignedCondition = new Condition();
13+
private Map<String, Factor> assignedFactor;
1014

1115
public MarkExperimentRequestData() {
1216
super();
@@ -22,7 +26,15 @@ public MarkExperimentRequestData(String site, String target, Condition assignedC
2226
super();
2327
this.site = site;
2428
this.target = target;
25-
this.assignedCondition = assignedCondition;
29+
this.assignedCondition = assignedCondition != null ? assignedCondition : new Condition();
30+
}
31+
32+
public MarkExperimentRequestData(String site, String target, Condition assignedCondition, Map<String, Factor> assignedFactor){
33+
super();
34+
this.site = site;
35+
this.target = target;
36+
this.assignedCondition = assignedCondition != null ? assignedCondition : new Condition();
37+
this.assignedFactor = assignedFactor;
2638
}
2739

2840
public String getSite() {
@@ -46,7 +58,7 @@ public Condition getAssignedCondition() {
4658
}
4759

4860
public void setAssignedCondition(Condition assignedCondition) {
49-
this.assignedCondition = assignedCondition;
61+
this.assignedCondition = assignedCondition != null ? assignedCondition : new Condition();
5062
}
5163

5264
}

0 commit comments

Comments
 (0)