Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 50 additions & 60 deletions frontend/src/components/Grading/StudentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,64 @@ interface Evaluation {
uploadedAt: string;
}

const StudentTable: React.FC<{ evaluation: Evaluation }> = ({ evaluation }) => {
if (!evaluation) {
const StudentTable: React.FC<{ evaluations: Evaluation[] }> = ({ evaluations }) => {
if (!evaluations || evaluations.length === 0) {
return <div>No evaluation data available</div>;
}

return (
<div className="card">
<h2>Evaluation Details</h2>
<table>
<tbody>
<tr>
<th>Student Name</th>
<td>{evaluation.studentName}</td>
</tr>
<tr>
<th>Email</th>
<td>{evaluation.email}</td>
</tr>
<tr>
<th>Uploaded At</th>
<td>{new Date(evaluation.uploadedAt).toLocaleString()}</td>
</tr>
<tr>
<th>Session ID</th>
<td>{evaluation.sessionId}</td>
</tr>
<tr>
<th>Activity ID</th>
<td>{evaluation.activityId}</td>
</tr>
<tr>
<th>Student ID</th>
<td>{evaluation.studentId}</td>
</tr>
<tr>
<th>Code Submission</th>
<td>{evaluation.codeSubmission}</td>
</tr>
<tr>
<th>AI Evaluation</th>
<td>
{evaluation.aiEvaluation ? (
<>
<div>Score: {evaluation.aiEvaluation.score}</div>
<div>Feedback: {evaluation.aiEvaluation.feedback}</div>
</>
) : (
'N/A'
)}
</td>
</tr>
<tr>
<th>Instructor Evaluation</th>
<td>
{evaluation.instructorEvaluation ? (
<>
<div>Score: {evaluation.instructorEvaluation.score}</div>
<div>Feedback: {evaluation.instructorEvaluation.feedback}</div>
</>
) : (
'N/A'
)}
</td>
<div className="mb-6 bg-white rounded-lg shadow-lg p-6">
<h2 className="text-xl font-bold mb-4">Evaluations</h2>
<table className="min-w-full">
<thead>
<tr className="border-b">
<th className="text-left p-4">Student Name</th>
<th className="text-left p-4">Email</th>
<th className="text-left p-4">Uploaded At</th>
<th className="text-left p-4">Session ID</th>
<th className="text-left p-4">Activity ID</th>
<th className="text-left p-4">Student ID</th>
<th className="text-left p-4">Code Submission</th>
<th className="text-left p-4">AI Evaluation</th>
<th className="text-left p-4">Instructor Evaluation</th>
</tr>
</thead>
<tbody>
{evaluations.map((evaluation, index) => (
<tr key={index} className="border-b">
<td className="p-4">{evaluation.studentName}</td>
<td className="p-4">{evaluation.email}</td>
<td className="p-4">{new Date(evaluation.uploadedAt).toLocaleString()}</td>
<td className="p-4">{evaluation.sessionId}</td>
<td className="p-4">{evaluation.activityId}</td>
<td className="p-4">{evaluation.studentId}</td>
<td className="p-4">{evaluation.codeSubmission}</td>
<td className="p-4">
{evaluation.aiEvaluation ? (
<>
<div>Score: {evaluation.aiEvaluation.score}</div>
<div>Feedback: {evaluation.aiEvaluation.feedback}</div>
</>
) : (
'N/A'
)}
</td>
<td className="p-4">
{evaluation.instructorEvaluation ? (
<>
<div>Score: {evaluation.instructorEvaluation.score}</div>
<div>Feedback: {evaluation.instructorEvaluation.feedback}</div>
</>
) : (
'N/A'
)}
</td>
</tr>
))}
</tbody>
</table>
</div>
);
};

export default StudentTable;
export default StudentTable;
8 changes: 3 additions & 5 deletions frontend/src/pages/ViewStudents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
import StudentTable from "./../components/Grading/StudentTable"; // Adjusted import for clarity
import StudentTable from "./../components/Grading/StudentTable";
import Sidebar from "../components/Sidebar";
import GradesReport from "@/components/Grading/GradesReport";

Expand Down Expand Up @@ -29,12 +29,10 @@ const ViewStudents: React.FC = () => {
</div>

<div className="w-3/4 max-container mx-auto mt-20">
<div className="w-full mx-auto mt-10 p-8 ml-20">
<div className="w-full mx-auto mt-10 p-8 ml-20 bg-white rounded-lg shadow-lg">
<h2 className="text-3xl font-bold mb-6">Student Submissions</h2>
{studentData.length > 0 ? (
studentData.map((student, index) => (
<StudentTable key={index} evaluation={student} />
))
<StudentTable evaluations={studentData} />
) : (
<div>No evaluations available</div>
)}
Expand Down