diff --git a/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/hooks.js b/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/hooks.js index 1133067e..97db0d49 100644 --- a/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/hooks.js +++ b/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/hooks.js @@ -23,7 +23,12 @@ export const useFeedbackList = (submissionUUID) => { if (submissionUUID) { setIsLoadingFeedbackList(true); try { - const data = await api.getFeedbackList(submissionUUID, feedbackListType); + let data; + if (feedbackListType === 'received') { + data = await api.getFeedbackFromList(submissionUUID); + } else { + data = await api.getFeedbackToList(submissionUUID); + } const { assessments } = data; const formatData = assessmentTableFormat(assessments); setFeedbackList(formatData); diff --git a/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/utils.js b/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/utils.js index 7d0ea58a..41872f09 100644 --- a/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/utils.js +++ b/src/containers/ReviewProblemStepsModal/components/ReviewProblemStepsContent/utils.js @@ -6,9 +6,9 @@ import { v4 as uuidv4 } from 'uuid'; * @returns {Array} - Returns an array of formatted assessment data. */ export const assessmentTableFormat = (arr) => arr.map(({ - idAssessment, assesmentDate, scorerEmail, scorerName, scorerUsername, feedback, problemStep, assesmentScores, + idAssessment, assessmentDate, scorerEmail, scorerName, scorerUsername, feedback, problemStep, assessmentScores, }) => { - const newAssesmentScores = assesmentScores.map(({ criterionName, scoreEarned, scoreType }) => ({ + const newAssessmentScores = assessmentScores.map(({ criterionName, scoreEarned, scoreType }) => ({ id: uuidv4(), type: criterionName, quality: scoreType, rate: scoreEarned, })); return { @@ -16,8 +16,8 @@ export const assessmentTableFormat = (arr) => arr.map(({ reviewerName: scorerName, userName: scorerUsername, email: scorerEmail, - assessmentDate: assesmentDate, - assessmentScores: newAssesmentScores, + assessmentDate, + assessmentScores: newAssessmentScores, feedback, problemStep, }; diff --git a/src/data/services/lms/api.js b/src/data/services/lms/api.js index f8571b91..2eafea69 100644 --- a/src/data/services/lms/api.js +++ b/src/data/services/lms/api.js @@ -132,14 +132,24 @@ const updateGrade = (submissionUUID, gradeData) => post( ).then(response => response.data); /* - * get('api/assessments/feedback', { submissionUUID, assessmentType }) - * @param {object} feedbackData - full grading feedback of submission data + * get('api/assessments/feedback/from', { submissionUUID }) + * @param {object} feedbackData - full grading feedback received of submission data */ -const getFeedbackList = (submissionUUID, assessmentType) => get( - stringifyUrl(urls.getFeedbackSubmissionsUrl(), { +const getFeedbackFromList = (submissionUUID) => get( + stringifyUrl(urls.assessmentsFeedbackFromUrl(), { + [paramKeys.oraLocation]: locationId(), + [paramKeys.submissionUUID]: submissionUUID, + }), +).then(response => camelizeKeys(response.data)); + +/* + * get('api/assessments/feedback/to', { submissionUUID }) + * @param {object} feedbackData - full grading feedback given of submission data + */ +const getFeedbackToList = (submissionUUID) => get( + stringifyUrl(urls.assessmentFeedbackToUrl(), { [paramKeys.oraLocation]: locationId(), [paramKeys.submissionUUID]: submissionUUID, - [paramKeys.assessmentType]: assessmentType, }), ).then(response => camelizeKeys(response.data)); @@ -150,7 +160,8 @@ export default StrictDict({ fetchSubmissionStatus, lockSubmission, updateGrade, - getFeedbackList, + getFeedbackFromList, + getFeedbackToList, unlockSubmission, batchUnlockSubmissions, }); diff --git a/src/data/services/lms/constants.js b/src/data/services/lms/constants.js index 3ce1541e..b3b92237 100644 --- a/src/data/services/lms/constants.js +++ b/src/data/services/lms/constants.js @@ -33,7 +33,6 @@ export const fileUploadResponseOptions = StrictDict({ export const paramKeys = StrictDict({ oraLocation: 'oraLocation', submissionUUID: 'submissionUUID', - assessmentType: 'assessmentType', }); export const oraTypes = StrictDict({ diff --git a/src/data/services/lms/urls.js b/src/data/services/lms/urls.js index 4d208455..b25e0e20 100644 --- a/src/data/services/lms/urls.js +++ b/src/data/services/lms/urls.js @@ -13,7 +13,8 @@ const fetchSubmissionStatusUrl = () => `${baseEsgUrl()}submission/status`; const fetchSubmissionLockUrl = () => `${baseEsgUrl()}submission/lock`; const batchUnlockSubmissionsUrl = () => `${baseEsgUrl()}submission/batch/unlock`; const updateSubmissionGradeUrl = () => `${baseEsgUrl()}submission/grade`; -const getFeedbackSubmissionsUrl = () => `${baseEsgUrl()}assessments/feedback`; +const assessmentsFeedbackFromUrl = () => `${baseEsgUrl()}assessments/feedback/from/`; +const assessmentFeedbackToUrl = () => `${baseEsgUrl()}assessments/feedback/to/`; const course = (courseId) => `${baseUrl()}/courses/${courseId}`; @@ -35,5 +36,6 @@ export default StrictDict({ course, openResponse, ora, - getFeedbackSubmissionsUrl, + assessmentsFeedbackFromUrl, + assessmentFeedbackToUrl, });