Skip to content

Commit

Permalink
Merge pull request #32 from Lab-Lab-Lab/main
Browse files Browse the repository at this point in the history
upgrade nextjs, fix security vulnerability in dependency, and try not…
  • Loading branch information
hcientist authored Sep 13, 2024
2 parents ac518c3 + c8c6e98 commit c154968
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 57 deletions.
4 changes: 3 additions & 1 deletion api.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export function getAllPieces(slug) {
export function mutateAssignPiece(slug) {
return async (piecePlanId) => {
const endpoint = `courses/${slug}/assign_piece_plan/`;
const json = await makeRequest(endpoint, 'POST', { piece_id: piecePlanId });
const json = await makeRequest(endpoint, 'POST', {
piece_plan_id: piecePlanId,
});
return json;
};
}
Expand Down
30 changes: 27 additions & 3 deletions components/teacher/grade/perform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ListGroupItem from 'react-bootstrap/ListGroupItem';
import { Card, Col, Row } from 'react-bootstrap';
import dynamic from 'next/dynamic';
import { useRef, useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import RTE from './rte';

const FlatEditor = dynamic(() => import('../../flatEditor'), {
Expand Down Expand Up @@ -40,6 +41,20 @@ export default function GradePerform({ submissions }) {
submissions.map((submission, submissionIdx) => {
let rte;
let reflection;
let parsedScore;

if (
submission?.assignment?.activity?.activity_type?.category ===
'Create' &&
submission?.content
) {
try {
parsedScore = JSON.parse(submission.content);
} catch (e) {
console.error(e, submission.content);
}
}

if (
submission?.assignment?.activity?.activity_type?.category ===
'Respond' &&
Expand Down Expand Up @@ -121,9 +136,18 @@ export default function GradePerform({ submissions }) {
?.category === 'Create' &&
submission?.content && (
<ListGroupItem>
<FlatEditor
scoreJSON={JSON.parse(submission.content)}
/>
{parsedScore ? (
<ErrorBoundary
fallback={<div>Something went wrong</div>}
>
<FlatEditor scoreJSON={parsedScore} />
</ErrorBoundary>
) : (
<div>
<p>no score/erroneous score</p>
<pre>{submission.content}</pre>
</div>
)}
</ListGroupItem>
)}
<ListGroupItem>
Expand Down
132 changes: 80 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"date-fns": "^2.28.0",
"flat-embed": "^1.4.0",
"mic-recorder-to-mp3": "^2.2.2",
"next": "^14.2.3",
"next": "^14.2.5",
"next-auth": "^4.2.1",
"next-redux-wrapper": "^8.1.0",
"react": "^18.3.1",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"react-icons": "^4.3.1",
"react-query": "^3.34.17",
"react-redux": "^7.1.0",
Expand Down

0 comments on commit c154968

Please sign in to comment.