Skip to content

Commit

Permalink
- partial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Nov 26, 2020
1 parent 36c1f58 commit b406141
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 2 additions & 3 deletions js/components/datasets/redux/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ export const getFilteredDatasetMoleculeList = createSelector(
for (let prioAttr of sortedAttributes) {
const order = filterProperties[prioAttr].order;

const scoreValueOfA =
let scoreValueOfA =
Object.keys(a.numerical_scores).find(key => key === prioAttr) && a.numerical_scores[prioAttr];
scoreValueOfA =
scoreValueOfA || (Object.keys(a.text_scores).find(key => key === prioAttr) && a.text_scores[prioAttr]);
const scoreValueOfB =
let scoreValueOfB =
Object.keys(b.numerical_scores).find(key => key === prioAttr) && b.numerical_scores[prioAttr];
scoreValueOfB =
scoreValueOfB || (Object.keys(b.text_scores).find(key => key === prioAttr) && b.text_scores[prioAttr]);
Expand All @@ -296,7 +296,6 @@ export const getFilteredDatasetMoleculeList = createSelector(
}
}
});
return filteredMolecules;
}
return datasetMoleculeList;
}
Expand Down
15 changes: 15 additions & 0 deletions js/components/preview/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ const Preview = memo(({ isStateLoaded, hideProjects }) => {
const currentDataset = customDatasets[selectedDatasetIndex];
const target_on = useSelector(state => state.apiReducers.target_on);

const all_mol_lists = useSelector(state => state.apiReducers.all_mol_lists);
const moleculeLists = useSelector(state => state.datasetsReducers.moleculeLists);
const isLoadingMoleculeList = useSelector(state => state.datasetsReducers.isLoadingMoleculeList);

/*
Loading datasets
*/
Expand All @@ -117,6 +121,17 @@ const Preview = memo(({ isStateLoaded, hideProjects }) => {
}
}, [customDatasets.length, dispatch, target_on]);

useEffect(() => {
const allMolsGroupsCount = Object.keys(all_mol_lists || {}).length;
const moleculeListsCount = Object.keys(moleculeLists || {}).length;
if (allMolsGroupsCount > 0 && moleculeListsCount > 0 && !isLoadingMoleculeList) {
const keys = Object.keys(moleculeLists);
keys.forEach(key => {
let dataset = moleculeLists[key];
});
}
}, [all_mol_lists, moleculeLists, isLoadingMoleculeList]);

const [molGroupsHeight, setMolGroupsHeight] = useState(0);
const [filterItemsHeight, setFilterItemsHeight] = useState(0);
const [filterItemsHeightDataset, setFilterItemsHeightDataset] = useState(0);
Expand Down
1 change: 0 additions & 1 deletion js/components/preview/molecule/moleculeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
const firstLoad = useSelector(state => state.selectionReducers.firstLoad);
const target_on = useSelector(state => state.apiReducers.target_on);
const mol_group_on = useSelector(state => state.apiReducers.mol_group_on);
const cached_mol_lists = useSelector(state => state.apiReducers.cached_mol_lists);

const allInspirationMoleculeDataList = useSelector(state => state.datasetsReducers.allInspirationMoleculeDataList);

Expand Down
6 changes: 3 additions & 3 deletions js/components/preview/molecule/redux/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ export const selectJoinedMoleculeList = createSelector(
);

export const getMoleculeList = createSelector(
getCachedMoleculeLists,
getAllMolecules,
getMoleculeGroupLists,
(cached_mol_lists, mol_group_list) => {
(all_mol_lists, mol_group_list) => {
let cachedDataArray = [];
if (mol_group_list) {
mol_group_list.forEach(obj => {
const cachedData = cached_mol_lists[obj.id];
const cachedData = all_mol_lists[obj.id];

if (cachedData && Array.isArray(cachedData)) {
cachedDataArray.push(...cachedData);
Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/moleculeGroups/molGroupChecklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const molGroupChecklist = memo(({}) => {
color="primary"
checked={checked}
onChange={event => dispatch(onSelectMoleculeGroup({ moleculeGroup, stageSummaryView, majorViewStage, selectGroup: event.target.checked }))}
disabled={disableUserInteraction}
disabled={false}
/>
</Grid>
<Grid item xs={10} className={checked ? classes.selectedLine : null}>
Expand Down

0 comments on commit b406141

Please sign in to comment.