WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit b8046af

Browse files
feat(AP-4039): Confirm on an entry point when there are no variants
1 parent 678b386 commit b8046af

File tree

4 files changed

+63
-10
lines changed

4 files changed

+63
-10
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@
103103
"dependencies": {
104104
"yui-lint": "^0.2.0"
105105
}
106-
}
106+
}

src/store.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,14 @@ export function generateEffectiveGenome(expsKeyStates, genomes) {
349349
const activeEids = new Set();
350350
expsKeyStates.forEach(function (expKeyStates, eid) {
351351
const active = expKeyStates.get('active');
352-
if (eid in genomes && active) {
353-
const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active);
352+
if (active) {
353+
activeEids.add(eid);
354+
if (eid in genomes) {
355+
const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active);
354356

355-
if (Object.keys(activeGenome).length) {
356-
activeEids.add(eid);
357-
effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome);
357+
if (Object.keys(activeGenome).length) {
358+
effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome);
359+
}
358360
}
359361
}
360362
});

src/tests/store.test.js

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,47 @@ describe('store.js', () => {
754754
},
755755
"id": "64928df20a",
756756
"_paused": false
757-
}]
757+
},
758+
{
759+
"web": {
760+
"jo41drmyb": {
761+
"_is_entry_point": true,
762+
"_predicate": {
763+
"combinator": "and",
764+
"rules": [
765+
{
766+
"field": "web.url",
767+
"operator": "regex64_match",
768+
"value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvXC8/KD86JHxcP3wjKS9p"
769+
}
770+
]
771+
},
772+
"_initializers": true
773+
},
774+
"zl0f2e2e7": {
775+
"_is_entry_point": false,
776+
"_predicate": {
777+
"combinator": "and",
778+
"rules": [
779+
{
780+
"field": "web.url",
781+
"operator": "regex64_match",
782+
"value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvcGFnZTFcLmh0bWxcLz8oPzokfFw/fCMpL2k="
783+
}
784+
]
785+
},
786+
"7ulgknqr5": {
787+
"_values": true
788+
},
789+
"_initializers": true
790+
}
791+
},
792+
"_predicate": {},
793+
"id": "c4154ac833",
794+
"_paused": false,
795+
"_optimization_metric": "SESSION",
796+
"_include_eid_in_hash": true
797+
}]
758798
}
759799
genomes = {
760800
"60f67d8648": {
@@ -836,7 +876,6 @@ describe('store.js', () => {
836876

837877
const result = generateEffectiveGenome(configKeyStates.experiments, genomes);
838878

839-
expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648"]);
840879
expect(result.effectiveGenome).to.be.eql({
841880
"web": {
842881
"2nsqubits": {
@@ -865,7 +904,6 @@ describe('store.js', () => {
865904

866905
const result = generateEffectiveGenome(configKeyStates.experiments, genomes);
867906

868-
expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a"]);
869907
expect(result.effectiveGenome).to.be.eql({
870908
"web": {
871909
"2nsqubits": {
@@ -893,6 +931,19 @@ describe('store.js', () => {
893931
}
894932
});
895933
});
934+
935+
it('should include eid in activeEids even if there is no genome for it', () => {
936+
context.initialize(123, 321, {
937+
web: {
938+
url: 'https://test.site.com/index.html'
939+
}
940+
});
941+
setActiveAndEntryKeyStates(1, context, config, allocations, configKeyStates);
942+
943+
const result = generateEffectiveGenome(configKeyStates.experiments, genomes);
944+
945+
expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a", "c4154ac833"]);
946+
});
896947
});
897948

898949
describe('Views', () => {

0 commit comments

Comments
 (0)