Skip to content

Commit f29291a

Browse files
committed
[Fix] 이전으로...
1 parent f389fce commit f29291a

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
.env
1717
*.pem
1818
.idea/
19+
et --hard HEAD~1

frontend/src/pages/admin/AdminStudentAssignment.jsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,21 @@ const AdminStudentAssignment = () => {
6464
});
6565
}, [studentId, week]);
6666

67-
const handleStatusChange = (taskId, newStatus) => {
68-
const updatedWeeks = weeks.map((weekItem) => ({
69-
...weekItem,
70-
days: weekItem.days.map((dayItem) => ({
71-
...dayItem,
72-
tasks: dayItem.tasks.map((task) =>
73-
task.id === taskId
74-
? { ...task, status: newStatus, modified: true }
75-
: task
76-
),
77-
})),
78-
}));
79-
80-
setWeeks(updatedWeeks);
67+
const handleStatusChange = (weekIdx, dayIdx, taskIdx, newStatus) => {
68+
const updated = [...weeks];
69+
const task = updated[weekIdx].days[dayIdx].tasks[taskIdx];
70+
task.status = newStatus;
71+
task.modified = true;
72+
setWeeks(updated);
8173
};
82-
74+
/*
75+
const handleSave = async (taskId, status) => {
76+
await api.put("/admin/assignment/status", {
77+
assignmentId: taskId,
78+
status,
79+
});
80+
};
81+
*/
8382

8483

8584
const handleSave = async (taskId, status) => {
@@ -135,6 +134,8 @@ const AdminStudentAssignment = () => {
135134
value={task.status}
136135
onChange={(e) =>
137136
handleStatusChange(
137+
weekIdx,
138+
dayIdx,
138139
taskIdx,
139140
e.target.value
140141
)

0 commit comments

Comments
 (0)