Skip to content

Commit

Permalink
break point
Browse files Browse the repository at this point in the history
  • Loading branch information
ddecrulle committed Nov 27, 2023
1 parent a428756 commit 42b7783
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 8 additions & 2 deletions drama-queen/src/core/usecases/synchronizeData/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ export const { reducer, actions } = createSlice({
surveyUnitCompleted: 0,
})
),
setDownloadTotalSurveyUnitAndResetSurveyCompleted: (
updateDownloadTotalSurveyUnit: (
state,
{ payload }: PayloadAction<{ totalSurveyUnit: number }>
) => {
const { totalSurveyUnit } = payload;
assert(state.stateDescription === "running" && state.type === "download");
return { ...state, totalSurveyUnit, surveyCompleted: 0 };
return {
...state,
totalSurveyUnit:
state.totalSurveyUnit === Infinity
? totalSurveyUnit
: state.totalSurveyUnit + totalSurveyUnit,
};
},
downloadSurveyUnitCompleted: (state) => {
assert(state.stateDescription === "running" && state.type === "download");
Expand Down
6 changes: 2 additions & 4 deletions drama-queen/src/core/usecases/synchronizeData/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const thunks = {
.getSurveyUnitsIdsAndQuestionnaireIdsByCampaign(campaignId)
.then((arrayOfIds) => {
dispatch(
actions.setDownloadTotalSurveyUnitAndResetSurveyCompleted({
actions.updateDownloadTotalSurveyUnit({
totalSurveyUnit: arrayOfIds.length,
})
);
Expand All @@ -51,9 +51,7 @@ export const thunks = {
queenApi
.getSurveyUnit(id)
.then((surveyUnit) => dataStore.updateSurveyUnit(surveyUnit))
.finally(() =>
dispatch(actions.downloadSurveyUnitCompleted())
)
.then(() => dispatch(actions.downloadSurveyUnitCompleted()))
)
);
})
Expand Down
4 changes: 2 additions & 2 deletions drama-queen/src/ui/pages/synchronize/SynchronizeData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export function SynchronizeData() {
const { synchronizeData } = useCoreFunctions();

useEffect(() => {
console.log("showProgress", showProgress)
}, [showProgress]);
console.log("surveyUnitProgress", surveyUnitProgress)
}, [surveyUnitProgress]);

useEffect(
() => {
Expand Down

0 comments on commit 42b7783

Please sign in to comment.