Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@
"dependencies": {
"yui-lint": "^0.2.0"
}
}
}
12 changes: 7 additions & 5 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ export function generateEffectiveGenome(expsKeyStates, genomes) {
const activeEids = new Set();
expsKeyStates.forEach(function (expKeyStates, eid) {
const active = expKeyStates.get('active');
if (eid in genomes && active) {
const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active);
if (active) {
activeEids.add(eid);
if (eid in genomes) {
const activeGenome = objects.filter(objects.deepClone(genomes[eid]), active);

if (Object.keys(activeGenome).length) {
activeEids.add(eid);
effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome);
if (Object.keys(activeGenome).length) {
effectiveGenome = objects.deepMerge(effectiveGenome, activeGenome);
}
}
}
});
Expand Down
57 changes: 54 additions & 3 deletions src/tests/store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,47 @@ describe('store.js', () => {
},
"id": "64928df20a",
"_paused": false
}]
},
{
"web": {
"jo41drmyb": {
"_is_entry_point": true,
"_predicate": {
"combinator": "and",
"rules": [
{
"field": "web.url",
"operator": "regex64_match",
"value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvXC8/KD86JHxcP3wjKS9p"
}
]
},
"_initializers": true
},
"zl0f2e2e7": {
"_is_entry_point": false,
"_predicate": {
"combinator": "and",
"rules": [
{
"field": "web.url",
"operator": "regex64_match",
"value": "L2h0dHBzPzpcL1wvbmUyY3QuY3NiLmFwcFwvcGFnZTFcLmh0bWxcLz8oPzokfFw/fCMpL2k="
}
]
},
"7ulgknqr5": {
"_values": true
},
"_initializers": true
}
},
"_predicate": {},
"id": "c4154ac833",
"_paused": false,
"_optimization_metric": "SESSION",
"_include_eid_in_hash": true
}]
}
genomes = {
"60f67d8648": {
Expand Down Expand Up @@ -836,7 +876,6 @@ describe('store.js', () => {

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

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

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

expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a"]);
expect(result.effectiveGenome).to.be.eql({
"web": {
"2nsqubits": {
Expand Down Expand Up @@ -893,6 +931,19 @@ describe('store.js', () => {
}
});
});

it('should include eid in activeEids even if there is no genome for it', () => {
context.initialize(123, 321, {
web: {
url: 'https://test.site.com/index.html'
}
});
setActiveAndEntryKeyStates(1, context, config, allocations, configKeyStates);

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

expect(Array.from(result.activeEids)).to.be.eql(["60f67d8648", "64928df20a", "c4154ac833"]);
});
});

describe('Views', () => {
Expand Down