Skip to content

Commit

Permalink
[TM-1352] remove unnecessary functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LimberHope committed Nov 15, 2024
1 parent b5757a9 commit aad3e97
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public function toArray($request)
'people_knowledge_skills_increased' => $this->people_knowledge_skills_increased,
'indirect_beneficiaries' => $this->indirect_beneficiaries,
'indirect_beneficiaries_description' => $this->indirect_beneficiaries_description,
'workdays_direct_total' => $this->workdays_direct_total,
'workdays_convergence_total' => $this->workdays_convergence_total,
'workdays_direct_total' => $this->workdays_direct,
'workdays_convergence_total' => $this->workdays_convergence,
'non_tree_total' => $this->non_tree_total,
'total_community_partners' => $this->total_community_partners,
];
Expand Down
12 changes: 1 addition & 11 deletions app/Models/V2/Projects/ProjectReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,24 +445,14 @@ public function getWorkdaysTotalAttribute(): int
return $projectReportTotal + $sumTotals('paid') + $sumTotals('volunteer');
}

public function getWorkdaysDirectTotalAttribute(): int
{
return $this->workdays_direct ?? 0;
}

public function getWorkdaysConvergenceTotalAttribute(): int
{
return $this->workdays_convergence ?? 0;
}

public function getNonTreeTotalAttribute(): int
{
if (empty($this->task_id)) {
return 0;
}

return TreeSpecies::where('speciesable_type', SiteReport::class)
->whereIn('speciesable_id', $this->task->siteReports()->select('id'))
->whereIn('speciesable_id', $this->task->siteReports()->hasBeenSubmitted()->select('id'))
->where('collection', TreeSpecies::COLLECTION_NON_TREE)
->visible()
->sum('amount');
Expand Down

0 comments on commit aad3e97

Please sign in to comment.