Commit 3bc8cfbb authored by Gamage B.G.J's avatar Gamage B.G.J

Merge branch 'feature/marks-calculator-updated-version' into 'master'

Feature/marks calculator updated version

See merge request !35
parents 3e742aa7 501a3cb2
This diff is collapsed.
......@@ -322,7 +322,7 @@ const Tutorial = () => {
((selectedItemContent?.taskItemMark! * parseInt(marksCalculator?.confidence!)) / 100)!,
0
))
}
}
dispatch(toInitialState())
}
}, [success])
......@@ -398,7 +398,10 @@ const Tutorial = () => {
</span>
</Typography>
<Typography variant="h4" sx={{ pt: 3, pb: 1, zIndex: 1 }}>
{(data?.tutorialMarkUser! / data?.tutorialMarks!) * 100}% Completed
{((data?.tutorialMarkUser! / data?.tutorialMarks!) * 100).toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}% Completed
</Typography>
<Box sx={{ maxWidth: '60%' }}>
<LinearProgress variant="determinate" color="success" value={(data?.tutorialMarkUser! / data?.tutorialMarks!) * 100} />
......
......@@ -53,7 +53,10 @@ const CurriculumSection = ({ curriculum, curriculumIndex }: { curriculum: curric
Your learning capacity is 80% as daily analytics
</Typography>
<Typography variant="h4" color="white" sx={{ pt: 8, pb: 1, zIndex: 1 }}>
{(curriculum?.curriculumMarkUser! / curriculum?.curriculumMark!) * 100}% Completed
{((curriculum?.curriculumMarkUser! / curriculum?.curriculumMark!) * 100).toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}% Completed
</Typography>
<Box sx={{ maxWidth: '60%' }}>
<LinearProgress variant="determinate" color="success" value={(curriculum?.curriculumMarkUser! / curriculum?.curriculumMark!) * 100} />
......
......@@ -41,11 +41,17 @@ const slice = createSlice({
state.isLoading = false;
},
// POST USER
// POST marksCalculatorSuccess
marksCalculatorSuccess(state, action) {
state.marksCalculator = action.payload.result;
state.success = "Marks Calculated Successfully."
},
// POST default marksCalculatorSuccess
defaultMarksCalculatorSuccess(state, action) {
state.marksCalculator = action.payload.result;
state.success = "Marks Calculated Successfully."
},
}
});
......@@ -76,8 +82,7 @@ export function CalculateMarks(curriculumIndex: number, tutorialIndex: number, i
return async () => {
dispatch(slice.actions.startLoading());
try {
// Construct the request body as needed (e.g., for formData)
try {
const formData = new FormData();
formData.append('image', imageData);
formData.append('class', targetClass);
......@@ -91,3 +96,29 @@ export function CalculateMarks(curriculumIndex: number, tutorialIndex: number, i
}
};
};
/**
* POST Default Marks Calculator
* @param original_image
* @param user_input_image
* @returns
*/
export function DefaultCalculateMarks(original_image: any, user_input_image: any) {
return async () => {
dispatch(slice.actions.startLoading());
try {
const formData = new FormData();
formData.append('original_image', original_image);
formData.append('user_input_image', user_input_image);
const response = await axiosServices.post(`/rest_node/marks-calculator/default`, formData);
dispatch(slice.actions.marksCalculatorSuccess(response.data));
} catch (error) {
dispatch(slice.actions.hasError(error));
} finally {
dispatch(slice.actions.finishLoading());
}
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment