Skip to content

Commit

Permalink
Merge pull request #4604 from UniversityOfHelsinkiCS/OOD-46
Browse files Browse the repository at this point in the history
[Backend] Added undefined check for thesisStats in facultyThesisWriters
  • Loading branch information
valtterikantanen authored Aug 14, 2024
2 parents 95fbe7d + 8496b1c commit 804fe9f
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 804fe9f

Please sign in to comment.