Skip to content

Commit

Permalink
[Study programmes] Divide progress stats into bachelor+master and bac…
Browse files Browse the repository at this point in the history
…helor study rights in master's programmes
  • Loading branch information
valtterikantanen committed Aug 16, 2024
1 parent d2dfb21 commit 9a00ae5
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 50 deletions.
1 change: 1 addition & 0 deletions services/backend/src/routes/studyProgramme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ router.get('/:id/evaluationstats', async (req: GetEvaluationStatsRequest, res: R
lastUpdated: gradData.lastUpdated,
graduations: gradData,
creditCounts: progressData?.creditCounts,
creditCountsCombo: progressData?.creditCountsCombo,
years: progressData?.years,
}

Expand Down
4 changes: 3 additions & 1 deletion services/frontend/src/common/InfoToolTips/studyprogramme.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ export const studyProgrammeToolTips = {
StudytrackProgress: `
Kuvaa koulutusohjelmassa tiettynä lukuvuonna aloittaneiden opiskelijoiden etenemistä opintopisteissä mitattuna. Esimerkiksi kategoriaan 20–40 kuuluvat opiskelijat, jotka ovat suorittaneet **vähintään 20**, mutta **alle 40** opintopistettä.
Opintopistekertymään on laskettu kaikki suoritukset, jotka opiskelija on suorittanut koulutusohjelmaan siirryttyään. Myös hyväksiluetut ja muuhun kuin valittuun koulutusohjelmaan tai opintosuuntaan tehdyt suoritukset lasketaan mukaan. Esimerkiksi jos opiskelija on valmistunut kandiohjelmasta 20.6.2020 ja siirtynyt maisteriohjelmaan seuraavana päivänä, ennen 21.6.2020 tehtyjä suorituksia ei huomioida opintopistekertymässä.
Opintopistekertymään on laskettu kaikki suoritukset, jotka opiskelija on suorittanut koulutusohjelmaan siirryttyään. Myös hyväksiluetut ja muuhun kuin valittuun koulutusohjelmaan tai opintosuuntaan tehdyt suoritukset lasketaan mukaan.
Maisteriohjelmien tilastoissa opiskelijat jaetaan kahteen ryhmään: niihin, joilla on oikeus suorittaa sekä kandidaatin että maisterin tutkinto (**Bachelor + master studyright**) ja niihin, joilla on oikeus suorittaa vain maisterin tutkinto (**Master studyright**). *Bachelor + master studyright* -tilastoissa aloitusvuosi on opiskelijan aloitusvuosi kandiohjelmassa, ja mukana ovat kaikki suoritukset, jotka opiskelija on suorittanut aloitettuaan kandiohjelmassa.
Jos sivun yläosassa on valittuna ”All studyrights” (oletus), mukana ovat myös ohjelmaan siirtyneet ja ohjelmasta pois siirtyneet opiskelijat.
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { DataTable } from '@/components/StudyProgramme/BasicOverview/DataTable'
import { StackedBarChart } from '@/components/StudyProgramme/BasicOverview/StackedBarChart'
import { BreakdownBarChart } from '@/components/StudyProgramme/BreakdownBarChart'
import { MedianTimeBarChart } from '@/components/StudyProgramme/MedianTimeBarChart'
import { BarChart } from '@/components/StudyProgramme/StudytrackOverview/BarChart'
import { BasicDataTable } from '@/components/StudyProgramme/StudytrackOverview/BasicDataTable'
import { ProgressOfStudents } from '@/components/StudyProgramme/StudytrackOverview/ProgressOfStudents'
import { Toggle } from '@/components/StudyProgramme/Toggle'
import '@/components/StudyProgramme/studyprogramme.css'
import { useGetEvaluationStatsQuery } from '@/redux/studyProgramme'
Expand All @@ -32,15 +31,25 @@ export const ProgrammeView = ({ studyprogramme }) => {
graduated: grad,
})

const {
tableStats,
chartStats,
tableTitles: creditTableTitles,
} = calculateStats(statistics?.data?.creditCounts, getTargetCreditsForProgramme(studyprogramme))
const creditTableStats = {}
creditTableStats[studyprogramme] = tableStats
const creditChartData = { creditGraphStats: {}, years: statistics?.data?.years }
creditChartData.creditGraphStats[studyprogramme] = chartStats
const progressStats = calculateStats(statistics?.data?.creditCounts, getTargetCreditsForProgramme(studyprogramme))
if (progressStats?.chartStats) {
progressStats.chartStats.forEach(creditCategory => {
const [total, ...years] = creditCategory.data
creditCategory.data = [total, ...years.reverse()]
})
}

const progressComboStats =
Object.keys(statistics?.data?.creditCountsCombo || {}).length > 0
? calculateStats(statistics.data.creditCountsCombo, getTargetCreditsForProgramme(studyprogramme) + 180)
: null

if (progressComboStats?.chartStats) {
progressComboStats.chartStats.forEach(creditCategory => {
const [total, ...years] = creditCategory.data
creditCategory.data = [total, ...years.reverse()]
})
}

const programmeName = statistics?.data?.programmeName && getTextIn(statistics?.data?.programmeName)

Expand Down Expand Up @@ -141,15 +150,12 @@ export const ProgrammeView = ({ studyprogramme }) => {
toolTips={studyProgrammeToolTips.GraduatedToggle}
value={graduated}
/>
<div className="section-container">
<BarChart cypress="StudytrackProgress" data={creditChartData} track={studyprogramme} />
<BasicDataTable
cypress="StudytrackProgress"
data={creditTableStats}
titles={creditTableTitles}
track={studyprogramme}
/>
</div>
<ProgressOfStudents
progressComboStats={progressComboStats}
progressStats={progressStats}
track={studyprogramme}
years={statistics.data.years}
/>
{getDivider('Graduation times', 'AverageGraduationTimes')}
<div className="toggle-container">
<Toggle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Redirect, useParams } from 'react-router-dom'
import { Segment } from 'semantic-ui-react'

import { useTitle } from '@/common/hooks'
import { FacultyView } from './FacultyView'
import { ProgrammeView } from './ProgrammeView'
import { UniversityView } from './UniversityView'

export const EvaluationOverview = () => {
const { id, level } = useParams()
useTitle('Evaluation overview')

if (!(level === 'programme' || level === 'faculty' || level === 'university') || (level !== 'university' && !id)) {
if (!['programme', 'faculty', 'university'].includes(level) || (level !== 'university' && !id)) {
return <Redirect to="/" />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exporting(ReactHighcharts.Highcharts)
exportData(ReactHighcharts.Highcharts)
accessibility(ReactHighcharts.Highcharts)

export const BarChart = ({ cypress, data, track }) => {
export const BarChart = ({ data, track }) => {
if (!data || !data.creditGraphStats || !data.creditGraphStats[track]) return null
const correctData = data.creditGraphStats[track]
const colors = generateGradientColors(correctData.length)
Expand Down Expand Up @@ -47,9 +47,5 @@ export const BarChart = ({ cypress, data, track }) => {
},
}

return (
<div className="graph-container" data-cy={`Graph-${cypress}`}>
<ReactHighcharts config={config} />
</div>
)
return <ReactHighcharts config={config} />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { BarChart } from './BarChart'
import { BasicDataTable } from './BasicDataTable'

export const ProgressOfStudents = ({ progressStats, progressComboStats, track, years }) => {
return (
<div style={{ marginBottom: '4rem', textAlign: 'center' }}>
{progressComboStats != null && (
<>
<h2 style={{ margin: '0 0 1rem 0' }}>Bachelor + master studyright</h2>
<div style={{ display: 'flex', alignItems: 'center', gap: '2rem', flexWrap: 'wrap' }}>
<div data-cy="Graph-StudytrackProgressCombo" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<BarChart
data={{
creditGraphStats: { [track]: progressComboStats.chartStats },
years,
}}
track={track}
/>
</div>
<div style={{ flex: '1 2 1000px', minWidth: '1000px' }}>
<BasicDataTable
data={{ [track]: progressComboStats.tableStats }}
titles={progressComboStats.tableTitles}
track={track}
/>
</div>
</div>
</>
)}
{progressComboStats != null && <h2 style={{ margin: '2rem 0 1rem 0' }}>Master studyright</h2>}
<div style={{ display: 'flex', alignItems: 'center', gap: '2rem', flexWrap: 'wrap' }}>
<div data-cy="Graph-StudytrackProgress" style={{ flex: '2 1 600px', minWidth: '600px' }}>
<BarChart
data={{
creditGraphStats: { [track]: progressStats.chartStats },
years,
}}
track={track}
/>
</div>
<div style={{ flex: '1 2 1000px', minWidth: '1000px' }}>
<BasicDataTable
data={{ [track]: progressStats.tableStats }}
titles={progressStats.tableTitles}
track={track}
/>
</div>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { MedianTimeBarChart } from '@/components/StudyProgramme/MedianTimeBarCha
import { Toggle } from '@/components/StudyProgramme/Toggle'
import '@/components/StudyProgramme/studyprogramme.css'
import { useGetStudytrackStatsQuery } from '@/redux/studyProgramme'
import { BarChart } from './BarChart'
import { BasicDataTable } from './BasicDataTable'
import { ProgressOfStudents } from './ProgressOfStudents'
import { StudytrackDataTable } from './StudytrackDataTable'
import { StudytrackSelector } from './StudytrackSelector'

Expand Down Expand Up @@ -65,22 +64,25 @@ export const StudytrackOverview = ({

const programmeCode = combinedProgramme ? `${studyprogramme}-${combinedProgramme}` : studyprogramme

const {
tableStats,
chartStats,
tableTitles: creditTableTitles,
} = calculateStats(stats?.data?.creditCounts, getTargetCreditsForProgramme(programmeCode))
if (chartStats) {
chartStats.forEach(creditCategory => {
const progressStats = calculateStats(stats?.data?.creditCounts, getTargetCreditsForProgramme(programmeCode))
if (progressStats?.chartStats) {
progressStats.chartStats.forEach(creditCategory => {
const [total, ...years] = creditCategory.data
creditCategory.data = [total, ...years.reverse()]
})
}

const creditTableStats = {}
creditTableStats[studyprogramme] = tableStats
const creditChartData = { creditGraphStats: {}, years: stats?.data?.years }
creditChartData.creditGraphStats[studyprogramme] = chartStats
const progressComboStats =
Object.keys(stats?.data?.creditCountsCombo || {}).length > 0
? calculateStats(stats.data.creditCountsCombo, getTargetCreditsForProgramme(programmeCode) + 180)
: null

if (progressComboStats?.chartStats) {
progressComboStats.chartStats.forEach(creditCategory => {
const [total, ...years] = creditCategory.data
creditCategory.data = [total, ...years.reverse()]
})
}

return (
<div className="studytrack-overview">
Expand Down Expand Up @@ -130,15 +132,12 @@ export const StudytrackOverview = ({
{track === '' || track === studyprogramme ? (
<>
{getDivider('Progress of students of the studyprogramme by starting year', 'StudytrackProgress')}
<div style={{ marginBottom: '5em' }}>
<BarChart cypress="StudytrackProgress" data={creditChartData} track={track || studyprogramme} />
<BasicDataTable
cypress="StudytrackProgress"
data={creditTableStats}
titles={creditTableTitles}
track={track || studyprogramme}
/>
</div>
<ProgressOfStudents
progressComboStats={progressComboStats}
progressStats={progressStats}
track={track || studyprogramme}
years={stats?.data?.years}
/>
</>
) : (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
Expand Down

0 comments on commit 9a00ae5

Please sign in to comment.