Skip to content

Commit

Permalink
[Close to graduation] Display when the data was last updated
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Nov 4, 2024
1 parent 78f8946 commit 4da174c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions services/frontend/src/components/CloseToGraduation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useLanguage } from '@/components/LanguagePicker/useLanguage'
import { getSemestersPresentFunctions } from '@/components/PopulationStudents/StudentTable/GeneralTab/columnHelpers/semestersPresent'
import { PaginatedSortableTable } from '@/components/SortableTable/PaginatedSortableTable'
import { StudentNameVisibilityToggle, useStudentNameVisibility } from '@/components/StudentNameVisibilityToggle'
import { ISO_DATE_FORMAT } from '@/constants/date'
import { ISO_DATE_FORMAT, LONG_DATE_TIME_FORMAT } from '@/constants/date'
import { useGetStudentsCloseToGraduationQuery } from '@/redux/closeToGraduation'
import { useGetFacultiesQuery } from '@/redux/facultyStats'
import { useGetSemestersQuery } from '@/redux/semesters'
Expand Down Expand Up @@ -178,7 +178,8 @@ const getColumns = (
].join('\n'),
}
: {},
helpText: 'You can see the attainment date, course code, and grade by hovering over the check mark',
helpText:
'The thesis attainment must be linked to the correct study right. You can see the attainment date, course code, and grade by hovering over the check mark.',
},
{
key: 'latestAttainmentDates',
Expand Down Expand Up @@ -319,6 +320,9 @@ export const CloseToGraduation = () => {
/>
</Form.Field>
</Form>
<Message info style={{ width: '100%' }}>
{`Last updated: ${reformatDate(students.lastUpdated, LONG_DATE_TIME_FORMAT)}`}
</Message>
<PaginatedSortableTable
columns={columns}
data={filteredStudents}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import moment from 'moment'
import { useState } from 'react'
import { Message, Segment } from 'semantic-ui-react'

import { LONG_DATE_TIME_FORMAT } from '@/constants/date'
import { useGetTopTeachersCategoriesQuery, useGetTopTeachersQuery } from '@/redux/teachers'
import { reformatDate } from '@/util/timeAndDate'
import { TeacherStatisticsTable } from '../TeacherStatisticsTable'
import { LeaderForm } from './LeaderForm'

Expand Down Expand Up @@ -47,11 +49,6 @@ export const TeacherLeaderBoard = () => {
text: name,
}))

const lastUpdated = new Date(topTeachers?.updated).toLocaleString(undefined, {
dateStyle: 'long',
timeStyle: 'medium',
})

return (
<div>
<Message>
Expand All @@ -68,7 +65,9 @@ export const TeacherLeaderBoard = () => {
yearoptions={yearOptions}
/>
<Segment loading={statsAreLoading}>
{topTeachers.stats?.length > 0 && <Message>{`Last updated: ${lastUpdated}`}</Message>}
{topTeachers.stats?.length > 0 && (
<Message>{`Last updated: ${reformatDate(topTeachers?.updated, LONG_DATE_TIME_FORMAT)}`}</Message>
)}
<TeacherStatisticsTable statistics={topTeachers.stats ?? []} variant="leaderboard" />
</Segment>
</div>
Expand Down
1 change: 1 addition & 0 deletions services/frontend/src/constants/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export const DISPLAY_DATE_FORMAT = 'DD.MM.YYYY'
export const DISPLAY_DATE_FORMAT_DEV = 'DD.MM.YYYY HH:mm:ss'
export const LONG_DATE_TIME_FORMAT = 'D MMMM YYYY [at] HH:mm:ss'
export const ISO_DATE_FORMAT = 'YYYY-MM-DD'
export const ISO_DATE_FORMAT_DEV = 'YYYY-MM-DD HH:mm:ss'
export const YEAR_DATE_FORMAT = 'YYYY'

0 comments on commit 4da174c

Please sign in to comment.