Skip to content

Commit 6d97f53

Browse files
committed
Updates on the updating challenges from assignment
1 parent 622f864 commit 6d97f53

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

src/components/groups/assignments/updateChallengeInfo.jsx

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const Editor = (props) => {
5252
const sendToFileApi = async () => {
5353
console.log("Not finished yet");
5454
toast.info("This is incomplete");
55+
await uploadChallenge('');
5556
return;
5657
const isValid = await validateNewChallege();
5758
if (isValid) {
@@ -97,41 +98,38 @@ const Editor = (props) => {
9798
fileId: fileId,
9899
};
99100

100-
const body = {
101-
id: props.id,
102-
challengeInfo,
103-
assignmentInfo: props.assignmentInfo.assignmentInfo,
104-
username: localStorage.getItem('username'),
105-
};
101+
console.log(challengeInfo);
106102

107-
const url = `${process.env.NEXT_PUBLIC_API_URL}/classroom-assignments/create-fork-assignment/${classCode}`;
108-
const data = await request(url, 'POST', body);
103+
/*
104+
const url = `${process.env.NEXT_PUBLIC_API_URL}/challenges/update-assignment-challenge`;
105+
const data = await request(url, 'PUT', challengeInfo);
109106
110107
if (data && data.success) {
111108
window.location.href = ``;
112109
}
110+
*/
113111
};
114112

115-
function loadProps() {
116-
setClassCode(props.classCode);
117-
setHints(props.challenge.hints);
118-
setContentPreview(props.challenge.content);
119-
setSolution(props.challenge.solution);
120-
setDifficulty(props.challenge.difficulty);
121-
setCategory(props.challenge.category);
122-
setExistingConfig(props.challenge.commands);
123-
setNewChallengeName(props.challenge.title);
124-
setAssignmentName(props.assignmentName);
125-
let hintPoints = [];
126-
let hintMessage = [];
127-
let h = props.challenge.hints;
128-
for(let i = 0; i < h.length; i++) {
129-
hintMessage.push(h[i].message);
130-
hintPoints.push(h[i].penalty);
113+
function loadProps() {
114+
setClassCode(props.classCode);
115+
setHints(props.challenge.hints);
116+
setContentPreview(props.challenge.content);
117+
setSolution(props.challenge.solution);
118+
setDifficulty(props.challenge.difficulty);
119+
setCategory(props.challenge.category);
120+
setExistingConfig(props.challenge.commands);
121+
setNewChallengeName(props.challenge.title);
122+
setAssignmentName(props.assignmentName);
123+
let hintPoints = [];
124+
let hintMessage = [];
125+
let h = props.challenge.hints;
126+
for(let i = 0; i < h.length; i++) {
127+
hintMessage.push(h[i].message);
128+
hintPoints.push(h[i].penalty);
129+
}
130+
setPenalty(hintPoints);
131+
setHints(hintMessage);
131132
}
132-
setPenalty(hintPoints);
133-
setHints(hintMessage);
134-
}
135133

136134

137135
useEffect(() => {
@@ -467,7 +465,7 @@ function loadProps() {
467465
disabled={isCreating}
468466
className="mr-2 mt-6 rounded-lg border-green-600 bg-green-900 px-4 py-2 text-2xl text-white shadow-lg hover:bg-green-800"
469467
>
470-
<i class="fas fa-send"></i> { isCreating? "Creating..." : "Create Challenge" }
468+
<i class="fas fa-send"></i> { isCreating? "Updating..." : "Update Challenge" }
471469
</button>
472470

473471
<button className="mr-2 mt-6 hidden rounded-sm border-blue-600 bg-blue-700 px-4 py-2 text-2xl text-white shadow-lg hover:bg-blue-800">

src/components/groups/teacherView.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const defaultImages = [
2222
'/FancyKana.png',
2323
'/ConfusedKana.png',
2424
'/TophatKana.png',
25-
2625
];
2726

2827
export default function TeacherView({ group }) {
@@ -317,7 +316,7 @@ export default function TeacherView({ group }) {
317316
))
318317
) : (
319318
<div className="mb-2 cursor-pointer rounded-sm border-l-4 border-red-600 bg-neutral-800/50 px-3 py-3 text-white hover:bg-neutral-800">
320-
<h1 className="pe-6 text-lg">No assignments here yet</h1>
319+
<h1 className="pe-6 text-lg">No upcoming assignments</h1>
321320
<h2 className="pe-6 text-sm">
322321
Create an assignment with the button above!
323322
</h2>

0 commit comments

Comments
 (0)