Skip to content

Commit

Permalink
feat: Use workshopCompleteDate for activity if no activitydate (#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
taustad authored Apr 30, 2024
1 parent 7c8da21 commit 00bf629
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions frontend/src/api/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const EVALUATION_DASHBOARD_FIELDS_FRAGMENT = gql`
status
projectId
indicatorActivityDate
workshopCompleteDate
project {
fusionProjectId
indicatorEvaluationId
Expand Down
43 changes: 21 additions & 22 deletions frontend/src/views/Project/Dashboard/Components/TablesAndTitles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,33 @@ const TablesAndTitles = ({
let followUpScore = null

Object.entries(evaluations).forEach((evaluation) => {
if (evaluation[1].projectId !== projectId) {
projectId = evaluation[1].projectId
const evalData = evaluation[1]
if (evalData.projectId !== projectId) {
projectId = evalData.projectId
}

if (projectIndicators.findIndex(pi => pi.evaluationId === evaluation[1].id) > -1 && evaluation[1].project.indicatorEvaluationId === evaluation[1].id) {
if (evaluation[1].indicatorActivityDate && evaluation[1].progression === Progression.FollowUp) {
activityDate = evaluation[1].indicatorActivityDate
}
}
else if (evaluation[1].project.indicatorEvaluationId === evaluation[1].id) {
if (evaluation[1].indicatorActivityDate && evaluation[1].progression === Progression.FollowUp) {
activityDate = evaluation[1].indicatorActivityDate
const isFollowUp = evalData.progression === Progression.FollowUp
const isIndicatorEvaluation = evalData.project.indicatorEvaluationId === evalData.id
const isProjectIndicator = projectIndicators.findIndex(pi => pi.evaluationId === evalData.id) > -1

if ((isProjectIndicator || isIndicatorEvaluation) && isFollowUp) {
if (evalData.indicatorActivityDate) {
activityDate = evalData.indicatorActivityDate
} else if (evalData.workshopCompleteDate) {
activityDate = evalData.workshopCompleteDate
}
}
})
if (projectBMTScores.length > 0) {
projectBMTScores.forEach((score: any, index: any) => {
if (score.projectId === projectId) {
followUpScore = score.bmtScore
}
})
}
else if (generatedBMTScores) {
generatedBMTScores.generateBMTScores.forEach((score: any, index: any) => {
if (score.projectId === projectId) {
followUpScore = score.followUpScore
}
})
const score = projectBMTScores.find((score: any) => score.projectId === projectId)
if (score) {
followUpScore = score.bmtScore
}
} else if (generatedBMTScores) {
const score = generatedBMTScores.generateBMTScores.find((score: any) => score.projectId === projectId)
if (score) {
followUpScore = score.followUpScore
}
}

return (
Expand Down

0 comments on commit 00bf629

Please sign in to comment.