[Student details] add groupIds to coursestats links

This commit is contained in:
joonas-a
2026-09-21 15:24:21 +03:00
committed by Aaro Koivukangas
parent 1915757425
commit d3b3d82fee
3 changed files with 8 additions and 7 deletions
+6 -6
View File
@@ -1,4 +1,4 @@
import { Op, QueryTypes } from 'sequelize'
import { Op } from 'sequelize'
import type { Credit, Student } from '@oodikone/shared/models'
import { CreditTypeCode, EnrollmentState, Unification } from '@oodikone/shared/types'
@@ -18,7 +18,6 @@ import {
SISStudyRightElementModel,
} from '../models'
import { TagModel, TagStudentModel } from '../models/kone'
import { dbConnections } from '../database/connection'
const byStudentNumber = async (studentNumber: string) => {
const [student, tags] = await Promise.all([
@@ -44,7 +43,7 @@ const byStudentNumber = async (studentNumber: string) => {
include: [
{
model: CourseModel,
attributes: ['code', 'name'],
attributes: ['code', 'name', 'groupId'],
required: true,
},
],
@@ -113,11 +112,11 @@ const byStudentNumber = async (studentNumber: string) => {
const getUnifyStatus = (unifyCourses: Unification): [boolean] | [true, false] => {
switch (unifyCourses) {
case 'unify':
case Unification.UNIFY:
return [true, false]
case 'open':
case Unification.OPEN:
return [true]
case 'regular':
case Unification.REGULAR:
return [false]
default:
return [true, false]
@@ -220,6 +219,7 @@ const formatSharedStudentData = ({
course: {
code: course.code,
name: course.name,
groupId: course.groupId,
},
date: attainment_date,
passed: CreditModel.passed({ credittypecode }) || CreditModel.improved({ credittypecode }),
@@ -95,7 +95,7 @@ export const CourseTables = ({ student, selectedStudyPlanId }) => {
size="small"
sx={{ height: 20, width: 20 }}
title={`View course statistics for ${getTextIn(course.name)} (${course.code})`}
to={`/coursestatistics?courseCodes=["${course.code}"]&separate=false&combineSubstitutions=true`}
to={`/coursestatistics?courses=${course.groupId}&separate=false&substitutions=true`}
>
<NorthEastIcon fontSize="small" />
</IconButton>,
+1
View File
@@ -85,6 +85,7 @@ export type StudentPageStudent = {
course: {
code: string
name: Name
groupId: string
}
date: Date
passed: boolean