Added more comment
This commit is contained in:
@@ -106,23 +106,20 @@ interface SkillsFeedbackResponse extends SkillsFeedbackRequest {
|
||||
}
|
||||
|
||||
const getSkillsFeedback = async (sections: SkillsFeedbackRequest[]) => {
|
||||
try {
|
||||
const backendRequest = await axios.post(
|
||||
`${process.env.BACKEND_URL}/grading_summary`,
|
||||
{ sections },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${process.env.BACKEND_JWT}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
const backendRequest = await axios.post(
|
||||
`${process.env.BACKEND_URL}/grading_summary`,
|
||||
{ sections },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${process.env.BACKEND_JWT}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return backendRequest.data?.sections;
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
return backendRequest.data?.sections;
|
||||
};
|
||||
|
||||
// perform the request with several retries if needed
|
||||
const handleSkillsFeedbackRequest = async (
|
||||
sections: SkillsFeedbackRequest[]
|
||||
): Promise<SkillsFeedbackResponse[] | null> => {
|
||||
@@ -150,6 +147,8 @@ const generateQRCode = async (link: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
// Radial Progress PNGs were generated with only two colors
|
||||
// and they use some baseline score (10%, 20%, 30%..)
|
||||
type RADIAL_PROGRESS_COLOR = "laranja" | "azul";
|
||||
|
||||
const getRadialProgressPNG = (
|
||||
@@ -157,6 +156,8 @@ const getRadialProgressPNG = (
|
||||
score: number,
|
||||
total: number
|
||||
) => {
|
||||
// calculate the percentage of the score
|
||||
// and round it to the closest available image
|
||||
const percent = (score / total) * 100;
|
||||
const remainder = percent % 10;
|
||||
const roundedPercent = percent - remainder;
|
||||
|
||||
Reference in New Issue
Block a user