Skip to content

Commit

Permalink
[Backend] Added undefined check for thesisStats to facultyThesisWriters
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirasanen committed Aug 14, 2024
1 parent 71feb64 commit 8496b1c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions services/backend/src/services/faculty/facultyThesisWriters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ const calculateCombinedStats = async (
const isMaster = degreeProgrammeType === degreeProgrammeTypes.master
const correctIndex = isBachelor ? 0 : 1

if (!combinedGraphStats[correctIndex].data) {
combinedGraphStats[correctIndex].data = [...thesisStats.data]
} else {
for (let i = 0; i < thesisStats.data.length; i++) {
combinedGraphStats[correctIndex].data[i] += thesisStats.data[i]
if (thesisStats) {
if (!combinedGraphStats[correctIndex].data) {
combinedGraphStats[correctIndex].data = [...thesisStats.data]
} else {
for (let i = 0; i < thesisStats.data.length; i++) {
combinedGraphStats[correctIndex].data[i] += thesisStats.data[i]
}
}
}

Expand Down

0 comments on commit 8496b1c

Please sign in to comment.