-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from CSID-DGU/frontend/feature/add-exam
FE: [feat] 사후 레포트, 엑셀 다운로드 완료
- Loading branch information
Showing
16 changed files
with
193 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { api, apiWithoutAuth } from "."; | ||
import { api } from "."; | ||
import { testSesstion } from "@/types/user"; | ||
import { RESTYPE } from "@/types/common"; | ||
|
||
export const getDashboardData = async ( | ||
examId: number | ||
): Promise<RESTYPE<testSesstion>> => { | ||
const response = await api.get(`/exams/${examId}/sessions`); | ||
const response = await api.get(`/exams/${examId}/users`); | ||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { api } from "."; | ||
import { ReportResponse } from "@/types/report"; | ||
|
||
export const getReportData = async ( | ||
examId: number | ||
): Promise<ReportResponse> => { | ||
const response = await api.get(`/exams/${examId}/report`); | ||
return response.data; | ||
}; | ||
|
||
// 사후 레포트 엑셀 다운로드 | ||
export const downloadReport = async (examId: number) => { | ||
try { | ||
const response = await api.get(`/exams/${examId}/report/download`, { | ||
responseType: "blob", | ||
}); | ||
|
||
const blob = new Blob([response.data], { | ||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", | ||
}); | ||
|
||
const url = window.URL.createObjectURL(blob); | ||
const link = document.createElement("a"); | ||
link.href = url; | ||
link.download = "report.xlsx"; | ||
document.body.appendChild(link); | ||
|
||
link.click(); | ||
document.body.removeChild(link); | ||
window.URL.revokeObjectURL(url); | ||
} catch (error) { | ||
console.error("엑셀 다운로드 중 에러가 발생했습니다: ", error); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 18 additions & 9 deletions
27
src/frontend/eyesee-admin/src/app/report/[examId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 37 additions & 9 deletions
46
src/frontend/eyesee-admin/src/components/report/ReportSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getDashboardData } from "@/apis/dashBoard"; | ||
import { downloadReport, getReportData } from "@/apis/report"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
export const useDashboarReportdData = (examId: number) => { | ||
return useQuery({ | ||
queryKey: ["dashboard", examId], | ||
queryFn: () => getDashboardData(examId), | ||
}); | ||
}; | ||
|
||
export const useReportdData = (examId: number) => { | ||
return useQuery({ | ||
queryKey: ["report", examId], | ||
queryFn: () => getReportData(examId), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export type ReportResponse = { | ||
examName: string; | ||
totalCheatingCount: number; | ||
cheatingStudentsCount: number; | ||
averageCheatingCount: number; | ||
maxCheatingStudent: string; | ||
cheatingRate: number; | ||
cheatingTypeStatistics: { | ||
[key: string]: number; | ||
}; | ||
peakCheatingTimeRange: string; | ||
}; |
Oops, something went wrong.