From 5075affeda5c564769c636daef78b7ef588183ab Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 13 Sep 2023 00:36:01 +0900 Subject: [PATCH 1/4] [feat/#69] Fix: list duplicates --- src/components/Submit.tsx | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/components/Submit.tsx b/src/components/Submit.tsx index 52a74cd..786c90b 100644 --- a/src/components/Submit.tsx +++ b/src/components/Submit.tsx @@ -26,19 +26,23 @@ const Submit: FC = () => { useEffect(() => { api.client.get("/steps/" + assignment_id).then((response) => { if (isProfessor) { - for (let i = 0; i < response.data.length; i++) { - tmpList.push({ - id: response.data[i].id, - name: response.data[i].name, - step: response.data[i].step, - score: response.data[i].score, - user_id: user_id, - assignment_id: assignment_id, - lecture_id: lecture_id, - isProfessor: isProfessor, - } as SubmitterPropType); - } - setSubmittersPropsList(tmpList); + console.log(response.data) + // 기존 코드로 인해 list에 값이 중복으로 들어가게 되므로 삭제 + //for (let i = 0; i < response.data.length; i++) { + // tmpList.push({ + // id: response.data[i].id, + // name: response.data[i].name, + // step: response.data[i].step, + // score: response.data[i].score, + // user_id: user_id, + // assignment_id: assignment_id, + // lecture_id: lecture_id, + // isProfessor: isProfessor, + // } as SubmitterPropType); + // console.log(tmpList) + // } + // setSubmittersPropsList(tmpList); + setSubmittersPropsList(response.data) } else { // 학생 것만 보이게 for (let i = 0; i < response.data.length; i++) { @@ -54,12 +58,13 @@ const Submit: FC = () => { } as SubmitterPropType); } } - setSubmittersPropsList(tmpList); + console.log(submittersPropsList) } }); }, []); const autoScore = () => { + console.log(submittersPropsList) // user_id is professor console.log("/users/" + user_id + "/urls"); api.client.get("/users/" + user_id + "/urls").then((response) => { From 48f11d470c6987792d323f68e464b982302dcf9c Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 13 Sep 2023 02:06:50 +0900 Subject: [PATCH 2/4] [feat/#69] Fix: auto score --- src/components/Submit.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Submit.tsx b/src/components/Submit.tsx index 786c90b..c6905dd 100644 --- a/src/components/Submit.tsx +++ b/src/components/Submit.tsx @@ -72,27 +72,28 @@ const Submit: FC = () => { response.data.map((urlmodel: any) => { const apiEP = urlmodel.apiEndpoint; for (let i = 0; i < submittersPropsList.length; i++) { - var student_id = submittersPropsList[i].id; axios .get( apiEP + "/assignment/?id=" + - student_id + + submittersPropsList[i].id + "&assignment_id=" + assignment_id ) .then((response) => { + console.log(response) var answer = JSON.parse(response.data).answer; var runtime = JSON.parse(response.data).runtime; let params = { - user_id: student_id, + user_id: submittersPropsList[i].id, answer: answer.slice(0, -1), // infra comes with /n runtime: 1.0, }; + console.log(params) api.client .post("/assignments/" + assignment_id + "/auto", params) .then(() => { - window.location.reload(); + console.log("자동채점 api 호출") }); }); } From 445edaec74fd2b7a52acaec03985011739551198 Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 15 Sep 2023 00:01:19 +0900 Subject: [PATCH 3/4] [feat/#69] Fix: autoScore --- src/components/Submit.tsx | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/components/Submit.tsx b/src/components/Submit.tsx index c6905dd..55a7468 100644 --- a/src/components/Submit.tsx +++ b/src/components/Submit.tsx @@ -27,22 +27,22 @@ const Submit: FC = () => { api.client.get("/steps/" + assignment_id).then((response) => { if (isProfessor) { console.log(response.data) - // 기존 코드로 인해 list에 값이 중복으로 들어가게 되므로 삭제 - //for (let i = 0; i < response.data.length; i++) { - // tmpList.push({ - // id: response.data[i].id, - // name: response.data[i].name, - // step: response.data[i].step, - // score: response.data[i].score, - // user_id: user_id, - // assignment_id: assignment_id, - // lecture_id: lecture_id, - // isProfessor: isProfessor, - // } as SubmitterPropType); - // console.log(tmpList) - // } - // setSubmittersPropsList(tmpList); - setSubmittersPropsList(response.data) + //기존 코드로 인해 list에 값이 중복으로 들어가게 되므로 삭제 + for (let i = 0; i < response.data.length; i++) { + tmpList.push({ + id: response.data[i].id, + name: response.data[i].name, + step: response.data[i].step, + score: response.data[i].score, + user_id: user_id, + assignment_id: assignment_id, + lecture_id: lecture_id, + isProfessor: isProfessor, + } as SubmitterPropType); + console.log(tmpList) + } + setSubmittersPropsList(tmpList); + //setSubmittersPropsList(response.data) } else { // 학생 것만 보이게 for (let i = 0; i < response.data.length; i++) { @@ -96,10 +96,10 @@ const Submit: FC = () => { console.log("자동채점 api 호출") }); }); - } + } + }); }); - }); - }; + }; return ( <> From 922a1b0c34b70867b636b15d7ef8e2b48ae2a5ef Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 17 Sep 2023 15:39:45 +0900 Subject: [PATCH 4/4] [feat/#69] Fix: change step after all grading is completed --- src/components/Submit.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/Submit.tsx b/src/components/Submit.tsx index 55a7468..84bf6be 100644 --- a/src/components/Submit.tsx +++ b/src/components/Submit.tsx @@ -99,6 +99,13 @@ const Submit: FC = () => { } }); }); + // 채점 종료 진행상황 반영 + api.client + .get("steps/assignments/"+assignment_id+"/professor/"+user_id) + .then((response)=>{ + console.log(response.data) + }) + }; return (