Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
TanishqMehrunkarIIPSDAVV committed Oct 7, 2024
1 parent 6497165 commit 0c8f4e0
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/CompletedPaperDashboard/CompletedPaperDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const getFormattedDateTime = (date, time) => {
Completed on: {getFormattedDateTime(paper.endTime, paper.time)}
</div>
<div className="table-data">
<div className={`evaluation ${evaluations[0]}`}>
<div className={`evaluation ${evaluations[0]+"-completed"}`}>
<GoDotFill />
<div>{evaluations[0]}</div>
</div>
Expand Down
114 changes: 53 additions & 61 deletions src/CompletedPaperStudentDashboard/CompletedPaperStudentDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { useParams } from "react-router-dom";
import { GoDotFill } from "react-icons/go";
import { FaCheck } from "react-icons/fa";
import { ImCross } from "react-icons/im";
import image from "../Assets/profile_photo.png";
import image from "../Assets/profile_photo.png";

const CompletedPaperStudentDashboard = () => {
const [students, setStudents] = useState([]);
const [loading, setLoading] = useState(true);
const { paperId } = useParams();
const evaluations = ["Evaluated", "Not-Evaluated", "Evaluation-in-Progress"];
const attemptions = ["Attempted", "Not-Attempted"];
const [studentIds, setStudentIds] = useState([]);

useEffect(() => {
axios
Expand All @@ -33,7 +33,23 @@ const CompletedPaperStudentDashboard = () => {
setLoading(false);
}, 1000);
});
}, []);

axios
.post("http://localhost:5000/paper/getCompletedPaperByPaperId",{
paperId,
})
.then((res) => {
setStudentIds(res.data.students);
})
.catch((err) => {
console.error(err);
});
}, [paperId]);

const getAttemptionStatus = (studentId) => {
return studentIds.indexOf(studentId) === -1 ? "Not-Attempted" : "Attempted";
};

return (
<>
<Navbar />
Expand All @@ -46,65 +62,47 @@ const CompletedPaperStudentDashboard = () => {
<h2>Students:</h2>
</div>
<div className="exam-table">
{students.map((student, index) => (
<div
className="papers_table"
key={index}
// onClick={() => handleCardClick(student._id)}
// onMouseEnter={() => setHoveredItem(paper._id)}
// onMouseLeave={() => setHoveredItem(null)}
>
{/* Since delete and move features are removed, no buttons are shown */}
{/* <div className="scheduled">
Completed on: {getFormattedDateTime(paper.endTime, paper.time)}
</div> */}
<div className="table-data">
<div className="evaluation-attemption">
<div className={`evaluation ${evaluations[0]}`}>
<GoDotFill />
<div>{evaluations[0]}</div>
</div>
<div className={`attemption ${attemptions[0]}`}>
{attemptions[0] === "Attempted" ? (
<>
<FaCheck />
<div>Attempted</div>
</>
) : (
<>
{attemptions[0] === "Not-Attempted" ? (
<>
<ImCross />
<div>Not Attempted</div>
</>
) : (
<></>
)}
</>
)}
{students.map((student, index) => {
const attemption = getAttemptionStatus(student._id);
return (
<div className="papers_table" key={index}>
<div className="table-data completed-student">
<div className="evaluation-attemption">
<div className={`evaluation ${evaluations[index%3]}`}>
<GoDotFill />
<div>{evaluations[index%3]}&nbsp; {evaluations[index%3] === "Evaluated" && <>Alloted Marks: 20</>}</div>
</div>
<div className={`attemption ${attemption}`}>
{attemption === "Attempted" ? (
<>
<FaCheck />
<div>Attempted</div>
</>
) : (
<>
<ImCross />
<div>Not Attempted</div>
</>
)}
</div>
</div>
</div>
<div className="student-image-name">
<div className="student-image-name">
<div className="student-image">
<img src={image} alt="Image"/>
<img src={image} alt="Image" />
</div>
<div className="student-name">
<div className="classhead">{student.fullName}</div>
<div className="subname">Email: &nbsp;{student.email}</div>
<div className="subname">{student.rollNumber}</div>
<div className="classhead">{student.fullName}</div>
<div className="subname">
Email: &nbsp;{student.email}
</div>
<div className="subname">{student.rollNumber}</div>
<div className="subname">{student.phoneNumber}</div>
</div>
</div>
</div>
{/* <div className="subname">
{student.subject} ({student.subjectCode})
</div>
<div>
Duration: {student.duration.hours} hours{" "}
{student.duration.minutes} mins
</div>
<div>Marks: {student.marks}</div> */}
</div>
</div>
))}
);
})}
</div>
</>
) : (
Expand All @@ -116,12 +114,6 @@ const CompletedPaperStudentDashboard = () => {
</div>
)}
</div>
{/* <AlertModal
isOpen={modalIsOpen}
onClose={() => setModalIsOpen(false)}
message={modalMessage}
iserror={isError}
/> */}
</>
);
};
Expand Down
30 changes: 23 additions & 7 deletions src/papers/papers.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,28 @@
background-color: #282828;
border-radius: 3px;
}
.Evaluated
.Evaluated,.Evaluated-completed
{
color: green;
width: 255px;
}
.Evaluated-completed
{
width: 110px;
}
.Not-Evaluated
.Not-Evaluated,.Not-Evaluated-completed
{
color: red;
width: 145px;
}
.Evaluation-in-Progress
.Evaluation-in-Progress,.Evaluation-in-Progress-completed
{
color: yellow;
width: 210px;
}
.evaluation-attemption
{
display: flex;
justify-content: space-between;
align-items: center;
}
.attemption
Expand All @@ -224,6 +227,9 @@
border-radius: 3px;
height: 30px;
justify-content: center;
position: absolute;
top: 18px;
right: 20px;
}
.Attempted
{
Expand All @@ -240,7 +246,7 @@
display: flex;
gap: 50px;
align-items: center;
margin-top: 10px;
margin-top: 20px;
}
.student-image {
width: 100px;
Expand All @@ -259,7 +265,7 @@
}
.student-name
{
margin-top: -45px;
margin-top: -25px;
}
@media screen and (max-width: 768px) {
.student-image {
Expand All @@ -268,11 +274,16 @@
}
.student-image-name
{
margin-top: 5px;
gap: 10px;
}
.student-name
{
margin-top: -25px;
margin-top: 0px;
}
.Evaluated
{
width: 100px;
}
}

Expand All @@ -282,4 +293,9 @@
width: 60px;
height: 60px;
}
}

.completed-student
{
position: relative;
}

0 comments on commit 0c8f4e0

Please sign in to comment.