Skip to content

Commit

Permalink
[Faculties] Add missing Code title and tweak margin
Browse files Browse the repository at this point in the history
  • Loading branch information
rikurauhala committed Dec 11, 2024
1 parent 6df9836 commit eb1781e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
9 changes: 4 additions & 5 deletions services/backend/src/services/faculty/facultyBasics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { cloneDeep } from 'lodash'

import { NameWithCode } from '../../shared/types'
import { DegreeProgrammeType } from '../../types'
import { getBasicStats, setBasicStats } from '../analyticsService'
import { getBasicStatsForStudytrack } from '../studyProgramme/studyProgrammeBasics'
import type { ProgrammesOfOrganization } from './faculty'

type ProgrammeName = { code: string; en?: string; fi?: string; sv?: string }

type StudyTrackBasicStats = Awaited<ReturnType<typeof getBasicStatsForStudytrack>>

const calculateCombinedStats = async (
Expand All @@ -19,12 +18,12 @@ const calculateCombinedStats = async (
graphStats: [] as StudyTrackBasicStats['graphStats'],
programmeTableStats: {} as Record<string, StudyTrackBasicStats['tableStats']>,
tableStats: [] as StudyTrackBasicStats['tableStats'],
titles: ['', 'Started\nstudying', 'Accepted', 'Graduated'],
titles: ['Code', 'Started\nstudying', 'Accepted', 'Graduated'],
}
if (includeAllSpecials) {
studentInfo.titles.push('Transferred out\nof programme', 'Transferred into\nprogramme')
}
const programmeNames: Record<string, ProgrammeName> = {}
const programmeNames: Record<string, NameWithCode> = {}
let years: Array<string | number> = []

for (const programme of facultyProgrammes) {
Expand Down Expand Up @@ -143,7 +142,7 @@ const calculateCombinedStats = async (
graphStats: combinedGraphStats,
programmeTableStats: combinedProgrammeTableStats,
tableStats: combinedTableStats,
titles: ['', 'All', 'Bachelors', 'Masters', 'Doctors', 'Others'],
titles: ['Code', 'All', 'Bachelors', 'Masters', 'Doctors', 'Others'],
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const combineFacultyThesisWriters = async (
tableStats,
graphStats,
programmeTableStats,
titles: ['', 'All', 'Bachelors', 'Masters'],
titles: ['Code', 'All', 'Bachelors', 'Masters'],
programmeNames,
status: 'Done',
lastUpdated: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const makeTableStats = (data, showAll, isAcademicYear) => {
if (showAll) yearStats.splice(5, 0, Math.round(agreement), Math.round(separate))
tableStats.push(yearStats)
}
const titles = ['', 'Total', 'Degree students', 'Exchange students', 'Open university', 'Transferred']
const titles = ['Code', 'Total', 'Degree students', 'Exchange students', 'Open university', 'Transferred']
if (showAll) titles.splice(5, 0, 'Other university', 'Separate')
return { data: tableStats, titles }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TableSortLabel } from '@mui/material'
import { Box, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TableSortLabel } from '@mui/material'
import { Fragment, useState } from 'react'

import { facultyToolTips } from '@/common/InfoToolTips'
Expand Down Expand Up @@ -117,15 +117,21 @@ export const InteractiveDataTable = ({
<TableHead>
<TableRow>
{titles.map((title, index) => (
<TableCell align={index === 0 ? 'left' : 'right'} key={title}>
{index === 0 && <InfoBox content={facultyToolTips.interactiveDataTable} mini />}
<TableSortLabel
active={sorter === sorterNames[index]}
direction={sortDirection}
onClick={() => handleSortClick(sorterNames[index], index)}
>
{title}
</TableSortLabel>
<TableCell key={title}>
<Box alignItems="center" display="flex" justifyContent={index === 0 ? 'left' : 'right'}>
{index === 0 && (
<Box sx={{ marginRight: 1 }}>
<InfoBox content={facultyToolTips.interactiveDataTable} mini />
</Box>
)}
<TableSortLabel
active={sorter === sorterNames[index]}
direction={sortDirection}
onClick={() => handleSortClick(sorterNames[index], index)}
>
{title}
</TableSortLabel>
</Box>
</TableCell>
))}
</TableRow>
Expand Down

0 comments on commit eb1781e

Please sign in to comment.