[CourseStats][Summary] Display courseCode instead of groupId

This commit is contained in:
Aaro Koivukangas
2026-09-03 15:55:44 +03:00
parent 64cc3490f6
commit f1a74b9bce
5 changed files with 16 additions and 12 deletions
@@ -29,7 +29,7 @@ export const FoldableRow = ({
userHasAccessToAllStats: boolean
}) => {
const [isUnfolded, setIsUnfolded] = useState(true)
const { id, category, realisations } = courseData
const { groupId, courseCode, category, realisations } = courseData
const { getTextIn } = useLanguage()
const hasRealisations = realisations.length && realisations.length > 0
@@ -53,7 +53,7 @@ export const FoldableRow = ({
<IconButton size="small">{isUnfolded ? <KeyboardArrowDownIcon /> : <KeyboardArrowRightIcon />}</IconButton>
) : null}
</TableCell>
<TableCell align="left" onClick={() => onClickCourse(id)}>
<TableCell align="left" onClick={() => onClickCourse(groupId)}>
<Typography color={obfuscated ? 'text.secondary' : 'text.primary'} sx={{ cursor: 'pointer' }} variant="body2">
{isMainRow ? (
<>
@@ -62,7 +62,7 @@ export const FoldableRow = ({
</Typography>
{!userHasAccessToAllStats && <strong>*</strong>}{' '}
<Typography component="span" sx={{ color: 'text.secondary' }} variant="body2">
{id}
{courseCode}
</Typography>
</>
) : (
@@ -81,11 +81,11 @@ export const FoldableRow = ({
return (
<>
{getRow(id, courseData)}
{getRow(groupId, courseData)}
{showCourseRealisations
? realisations.map(row => {
const { realisation } = row
const realisationId = `${id}-${getTextIn(realisation)}`
const realisationId = `${groupId}-${getTextIn(realisation)}`
return getRow(realisationId, row, false)
})
: null}
@@ -33,7 +33,7 @@ export const AttemptsTable = ({
{data.map(course => (
<FoldableRow
courseData={course}
key={course.id}
key={course.groupId}
onClickCourse={onClickCourse}
userHasAccessToAllStats={userHasAccessToAllStats}
/>
@@ -45,11 +45,12 @@ export const SummaryTab = ({
}
const data = statistics.map(stat => {
const { coursecode, name, realisations, summary } = stat
const { groupId, courseCode, name, realisations, summary } = stat
const { passed, failed, passRate } = summary
return {
id: coursecode,
groupId,
courseCode,
category: getTextIn(name),
passed,
failed,
@@ -13,7 +13,8 @@ export type CourseStudyProgramme = {
students: Record<string, string[]>
}
export type CourseStatisticsSummary = {
coursecode: string
groupId: string
courseCode: string
name: Name
summary: { passed: number; failed: number; passRate: string | null }
realisations: {
@@ -181,8 +182,9 @@ export const getSummaryStatistics = (
const filterStudentFn = (studentNumber: string) => students.has(studentNumber)
return Object.entries(courseStats).map(([coursecode, { statistics, name }]) => ({
coursecode,
return Object.entries(courseStats).map(([groupId, { statistics, name, courseCode }]) => ({
groupId,
courseCode,
name,
summary: parseSummaryStats(statistics, filterStudentFn, userHasAccessToAllStats),
// No filters based on programmes can be applied, if the
+2 -1
View File
@@ -3,7 +3,8 @@ import { Name } from '@oodikone/shared/types'
export type AttemptData = {
category: string | null | undefined
failed: number
id: string
courseCode: string
groupId: string
passed: number
passRate: string | null
realisations: {