Skip to content

Commit

Permalink
- investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Jun 5, 2024
1 parent 634fd8d commit c764ae6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
28 changes: 14 additions & 14 deletions js/components/preview/tags/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,25 @@ const getTagsForMol = (molId, tagList) => {
};

export const loadMoleculesAndTagsNew = targetId => async (dispatch, getState) => {
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getTags`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getTags`);
let tags = await getTags(targetId);
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getTags`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getTags`);
tags = tags.results;
if (tags?.length > 0) {
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of tags received: ${tags?.length}`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of tags received: ${tags?.length}`);
dispatch(setNoTagsReceived(false));
}
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getTagCategories`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getTagCategories`);
const tagCategories = await getTagCategories();
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of tag categories received: ${tagCategories?.length}`);
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getTagCategories`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of tag categories received: ${tagCategories?.length}`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getTagCategories`);
// const canonSitesList = await getCanonSites(targetId);
// const canonConformSitest = await getCanonConformSites(targetId);

// console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getAllDataNew`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getAllDataNew`);
const data = await getAllDataNew(targetId);
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getAllDataNew`);
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of molecules received: ${data?.results?.length}`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getAllDataNew`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of molecules received: ${data?.results?.length}`);
let allMolecules = [];
data?.results?.forEach(mol => {
let newObject = { ...mol };
Expand Down Expand Up @@ -235,18 +235,18 @@ export const loadMoleculesAndTagsNew = targetId => async (dispatch, getState) =>
});

dispatch(setAllMolLists([...allMolecules]));
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of molecules stored: ${allMolecules?.length}`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of molecules stored: ${allMolecules?.length}`);
//need to do this this way because only categories which have at least one tag assigned are sent from backend
tags = tags.sort(compareTagsAsc);
dispatch(setMoleculeTags(tags));
dispatch(setTagSelectorData(tagCategories, tags));
dispatch(setAllDataLoaded(true));

// console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getPoses`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - before getPoses`);
return getPoses(targetId).then(poses => {
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getPoses`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - after getPoses`);
const modifiedPoses = [];
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of poses received: ${poses?.length}`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - no. of poses received: ${poses?.length}`);
poses?.forEach(pose => {
const siteObs = allMolecules.filter(m => pose.site_observations.includes(m.id));
const firstObs = siteObs[0];
Expand Down Expand Up @@ -280,6 +280,6 @@ export const loadMoleculesAndTagsNew = targetId => async (dispatch, getState) =>
return 0;
});
dispatch(setLHSCompoundsLIst(modifiedPoses));
// console.log(`snapshotDebug - loadMoleculesAndTagsNew - end of function`);
console.log(`snapshotDebug - loadMoleculesAndTagsNew - end of function`);
});
};
30 changes: 15 additions & 15 deletions js/reducers/tracking/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,16 +905,16 @@ export const restoreCurrentActionsList = snapshotID => async (dispatch, getState
};

const restoreTrackingActions = snapshotID => async (dispatch, getState) => {
// console.log(`snapshotDebug - restoreTrackingActions - start`);
console.log(`snapshotDebug - restoreTrackingActions - start`);
if (snapshotID) {
try {
// console.log(`snapshotDebug - restoreTrackingActions - before getting actions`);
console.log(`snapshotDebug - restoreTrackingActions - before getting actions`);
return api({
url: `${base_url}/api/snapshot-actions/?snapshot=${snapshotID}`
}).then(response => {
// console.log(`snapshotDebug - restoreTrackingActions - after getting actions`);
console.log(`snapshotDebug - restoreTrackingActions - after getting actions`);
let results = response.data.results;
// console.log(`snapshotDebug - restoreTrackingActions - no. of actions: ${results.length}`);
console.log(`snapshotDebug - restoreTrackingActions - no. of actions: ${results.length}`);
let listToSet = [];
results.forEach(r => {
let resultActions = JSON.parse(r.actions);
Expand All @@ -923,15 +923,15 @@ const restoreTrackingActions = snapshotID => async (dispatch, getState) => {

let snapshotActions = [...listToSet];
dispatch(setCurrentActionsList(snapshotActions));
// console.log(`snapshotDebug - restoreTrackingActions - end - success`);
console.log(`snapshotDebug - restoreTrackingActions - end - success`);
return Promise.resolve(snapshotActions);
// return Promise.resolve();
});
} catch (error) {
throw new Error(error);
}
} else {
// console.log(`snapshotDebug - restoreTrackingActions - end - no snapshot`);
console.log(`snapshotDebug - restoreTrackingActions - end - no snapshot`);
return Promise.resolve([]);
}
};
Expand Down Expand Up @@ -975,7 +975,7 @@ export const restoreAfterTargetActions = (stages, projectId, snapshotId) => asyn

// const currentActionList = state.trackingReducers.current_actions_list;
const orderedActionList = currentActionList.sort((a, b) => a.timestamp - b.timestamp);
// console.log(`snapshotDebug - restoreAfterTargetActions - no. of actions: ${orderedActionList.length}`);
console.log(`snapshotDebug - restoreAfterTargetActions - no. of actions: ${orderedActionList.length}`);
const targetId = state.apiReducers.target_on;

if (targetId && stages && stages.length > 0) {
Expand All @@ -996,12 +996,12 @@ export const restoreAfterTargetActions = (stages, projectId, snapshotId) => asyn
.finally(() => {});

await dispatch(restoreSitesActions(orderedActionList));
// console.log(`snapshotDebug - restoreAfterTargetActions - before loadData`);
console.log(`snapshotDebug - restoreAfterTargetActions - before loadData`);
await dispatch(loadData(orderedActionList, targetId, majorView));
// console.log(`snapshotDebug - restoreAfterTargetActions - after loadData`);
// console.log(`snapshotDebug - restoreAfterTargetActions - before restoreTagActions`);
console.log(`snapshotDebug - restoreAfterTargetActions - after loadData`);
console.log(`snapshotDebug - restoreAfterTargetActions - before restoreTagActions`);
await dispatch(restoreTagActions(orderedActionList));
// console.log(`snapshotDebug - restoreAfterTargetActions - after restoreTagActions`);
console.log(`snapshotDebug - restoreAfterTargetActions - after restoreTagActions`);
await dispatch(restoreMoleculesActions(orderedActionList, majorView.stage));
await dispatch(restoreRepresentationActions(orderedActionList, stages));
await dispatch(restoreProject(projectId));
Expand Down Expand Up @@ -1402,12 +1402,12 @@ export const restoreNglOrientationAnim = (orderedActionList, stages) => async (d
};

const loadData = (orderedActionList, targetId, majorView) => async (dispatch, getState) => {
// console.log(`snapshotDebug - loadData - before loadAllMolecules`);
console.log(`snapshotDebug - loadData - before loadAllMolecules`);
await dispatch(loadAllMolecules(targetId));
// console.log(`snapshotDebug - loadData - after loadAllMolecules`);
// console.log(`snapshotDebug - loadData - before loadAllDatasets`);
console.log(`snapshotDebug - loadData - after loadAllMolecules`);
console.log(`snapshotDebug - loadData - before loadAllDatasets`);
await dispatch(loadAllDatasets(orderedActionList, targetId, majorView.stage));
// console.log(`snapshotDebug - loadData - after loadAllDatasets`);
console.log(`snapshotDebug - loadData - after loadAllDatasets`);
};

const loadAllDatasets = (orderedActionList, target_on, stage) => async (dispatch, getState) => {
Expand Down

0 comments on commit c764ae6

Please sign in to comment.