Skip to content

Commit

Permalink
[Teachers] Fix crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
rikurauhala committed Jun 25, 2024
1 parent 0e2c546 commit 8f68620
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions services/backend/src/services/teachers.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ const getTeacherCredits = async (teacherIds, startSemester, endSemester) => {

const yearlyStatistics = async (providers, startSemester, endSemester) => {
const ids = await getActiveTeachers(providers, startSemester, endSemester)
if (!ids || ids.length === 0) {
return []
}
const teacherCredits = await getTeacherCredits(ids, startSemester, endSemester)
return teacherCredits
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { debounce } from 'lodash'
import { useState, useCallback } from 'react'
import { Link } from 'react-router-dom'
import { Message, Icon, Search, Segment, Item } from 'semantic-ui-react'
import { Message, Icon, Item, Search, Segment } from 'semantic-ui-react'

import { splitByEmptySpace, validateInputLength } from '@/common'
import { SortableTable } from '@/components/SortableTable'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export const TeacherStatistics = () => {
<TeacherStatisticsTable statistics={teacherStats} variant="leaderboard" />
</Segment>
)}
{!isLoading && !isFetching && teacherData && teacherStats.length === 0 && <Message content="No teachers found" />}
</div>
)
}

0 comments on commit 8f68620

Please sign in to comment.