feat: TeacherReportsetPage / TeacherReportsetDetailPage API 연결 확인 및 시간 표시 적용
This commit is contained in:
parent
bb46483d3e
commit
7f6b8f9880
@ -6,9 +6,7 @@ import { QuizDetailCard } from '../../components/QuizForm';
|
||||
|
||||
export default function StudentReportDetailPage() {
|
||||
const { reportId } = useParams();
|
||||
console.log(reportId);
|
||||
const { data } = useStudentReportDetail(reportId);
|
||||
console.log(data.data);
|
||||
const report = data.data;
|
||||
const { allCount, correctCount, quizzes, title } = report;
|
||||
const score = Math.round((100 * correctCount) / allCount);
|
||||
@ -24,9 +22,7 @@ export default function StudentReportDetailPage() {
|
||||
</Link>
|
||||
<div className={styles.title}>{title}</div>
|
||||
</header>
|
||||
<p>
|
||||
점수 : {score}점 ( {correctCount} / {allCount} )
|
||||
</p>
|
||||
<p>{allCount === 0 ? '미응시' : `점수 : ${score}점 ( ${correctCount} / ${allCount} )`}</p>
|
||||
<div className={styles.grid}>
|
||||
{quizzes.map((quiz, index) => (
|
||||
<QuizDetailCard
|
||||
|
@ -8,9 +8,7 @@ import { useParams } from 'react-router-dom';
|
||||
export default function StudentReportPage() {
|
||||
const { lectureId } = useParams();
|
||||
const { data } = useStudentReports(lectureId);
|
||||
console.log(data);
|
||||
const reports = data?.data;
|
||||
console.log(reports);
|
||||
|
||||
const totalCounts = reports.reduce(
|
||||
(acc, report) => {
|
||||
|
@ -8,21 +8,39 @@ export default function TeacherReportsetDetailPage() {
|
||||
const { data } = useReportSetDetail(reportsetId);
|
||||
const reports = data?.data;
|
||||
|
||||
console.log(reports);
|
||||
const formatDate = (dateArray) => {
|
||||
const date = new Date(...dateArray.slice(0, 6));
|
||||
return date.toLocaleString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
hour12: true,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ArticleBoard
|
||||
title="퀴즈 조회"
|
||||
canCreate={false}
|
||||
>
|
||||
{reports.length &&
|
||||
reports.map?.((report) => (
|
||||
<ArticleLink
|
||||
key={`${report.id}`}
|
||||
title={`${report.name} - ${report.title} 점수: ${report.correctCount}/${report.allCount}`}
|
||||
sub={`${report.date}`}
|
||||
to={`../../report/${report.id}`}
|
||||
/>
|
||||
))}
|
||||
reports.map?.((report) => {
|
||||
const formattedDate = formatDate(report.date);
|
||||
return (
|
||||
<ArticleLink
|
||||
key={`${report.reportId}`}
|
||||
title={
|
||||
report.correctCount == -1
|
||||
? `${report.name} - 미응시`
|
||||
: `${report.name} - ${report.title} 점수: ${report.correctCount}/${report.allCount}`
|
||||
}
|
||||
sub={`${formattedDate}`}
|
||||
to={`../report/${report.reportId}`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ArticleBoard>
|
||||
);
|
||||
}
|
||||
|
@ -8,21 +8,34 @@ export default function TeacherReportsetPage() {
|
||||
const { data } = useReportSets(lectureId);
|
||||
const reports = data?.data;
|
||||
|
||||
console.log(data);
|
||||
const formatDate = (dateArray) => {
|
||||
const date = new Date(...dateArray.slice(0, 6));
|
||||
return date.toLocaleString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
hour12: true,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ArticleBoard
|
||||
title="퀴즈 관리"
|
||||
title="퀴즈 성적 목록"
|
||||
canCreate={false}
|
||||
>
|
||||
{reports.length &&
|
||||
reports.map?.((report) => (
|
||||
{reports.map?.((report) => {
|
||||
const formattedDate = formatDate(report.testAt);
|
||||
return (
|
||||
<ArticleLink
|
||||
key={`${report.reportSetId}`}
|
||||
title={`${report.quizSetTitle}`}
|
||||
sub={`${report.testAt}`}
|
||||
sub={formattedDate}
|
||||
to={`${report.reportSetId}`}
|
||||
/>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</ArticleBoard>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user