Skip to content

Commit 34f3623

Browse files
author
Adriána Kohanová
committed
#444 The button X needs to be fixed (related to #407)
1 parent e1a3e86 commit 34f3623

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

js/components/datasets/redux/selectors.js

+17-10
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,24 @@ export const getFilteredDatasetMoleculeList = createSelector(
254254
for (let prioAttr of sortedAttributes) {
255255
const order = filterProperties[prioAttr].order;
256256

257-
const scoreValueOfA = Object.keys(a.numerical_scores).find(key => key === prioAttr) && a.numerical_scores[prioAttr];
258-
scoreValueOfA = scoreValueOfA || (Object.keys(a.text_scores).find(key => key === prioAttr) && a.text_scores[prioAttr]);
259-
const scoreValueOfB = Object.keys(b.numerical_scores).find(key => key === prioAttr) && b.numerical_scores[prioAttr];
260-
scoreValueOfB = scoreValueOfB || (Object.keys(b.text_scores).find(key => key === prioAttr) && b.text_scores[prioAttr]);
261-
262-
if (scoreValueOfA === "Y") {
257+
const scoreValueOfA =
258+
Object.keys(a.numerical_scores).find(key => key === prioAttr) && a.numerical_scores[prioAttr];
259+
scoreValueOfA =
260+
scoreValueOfA || (Object.keys(a.text_scores).find(key => key === prioAttr) && a.text_scores[prioAttr]);
261+
const scoreValueOfB =
262+
Object.keys(b.numerical_scores).find(key => key === prioAttr) && b.numerical_scores[prioAttr];
263+
scoreValueOfB =
264+
scoreValueOfB || (Object.keys(b.text_scores).find(key => key === prioAttr) && b.text_scores[prioAttr]);
265+
266+
if (scoreValueOfA === 'Y') {
263267
scoreValueOfA = 1;
264-
} else if (scoreValueOfA === "N") {
268+
} else if (scoreValueOfA === 'N') {
265269
scoreValueOfA = 0;
266270
}
267271

268-
if (scoreValueOfB === "Y") {
272+
if (scoreValueOfB === 'Y') {
269273
scoreValueOfB = 1;
270-
} else if (scoreValueOfB === "N") {
274+
} else if (scoreValueOfB === 'N') {
271275
scoreValueOfB = 0;
272276
}
273277

@@ -314,7 +318,10 @@ export const getCrossReferenceCompoundListByCompoundName = createSelector(
314318
Object.keys(moleculesDatasetMap).forEach(datasetID => {
315319
const currentList = moleculesDatasetMap[datasetID];
316320
if (currentList && Array.isArray(currentList)) {
317-
results.push({ molecule: currentList.find(item => item.name === compoundName), datasetID });
321+
let molecule = currentList.find(item => item.name === compoundName);
322+
if (molecule) {
323+
results.push({ molecule, datasetID });
324+
}
318325
}
319326
});
320327
return results;

0 commit comments

Comments
 (0)