Skip to content

Commit

Permalink
[TM-1562] add count to replanting collection
Browse files Browse the repository at this point in the history
  • Loading branch information
LimberHope committed Dec 19, 2024
1 parent 70f4388 commit 541bff2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/Http/Resources/V2/SiteReports/SiteReportResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function toArray($request)
'created_by' => $this->handleCreatedBy(),
'regeneration_description' => $this->regeneration_description,
'total_non_tree_species_planted_count' => $this->total_non_tree_species_planted_count,
'total_tree_replanting_count' => $this->total_tree_replanting_count,

'pct_survival_to_date' => $this->pct_survival_to_date,
'survival_calculation' => $this->survival_calculation,
Expand Down
5 changes: 5 additions & 0 deletions app/Models/V2/Sites/SiteReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ public function getTotalNonTreeSpeciesPlantedCountAttribute(): int
return $this->nonTreeSpecies()->visible()->sum('amount');
}

public function getTotalTreeReplantingCountAttribute(): int
{
return $this->replantingTreeSpecies()->visible()->sum('amount');
}

public function getTotalSeedsPlantedCountAttribute(): int
{
return $this->seedings()->visible()->sum('amount');
Expand Down
2 changes: 2 additions & 0 deletions app/Models/V2/TreeSpecies/TreeSpecies.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ class TreeSpecies extends Model implements EntityRelationModel
public const COLLECTION_DIRECT_SEEDING = 'direct-seeding';
public const COLLECTION_PLANTED = 'tree-planted';
public const COLLECTION_NON_TREE = 'non-tree';
public const COLLECTION_REPLANTING = 'replanting';
public const COLLECTION_NURSERY = 'nursery-seedling';
public const COLLECTION_HISTORICAL = 'historical-tree-species';

public static $collections = [
self::COLLECTION_DIRECT_SEEDING => 'Direct Seeding',
self::COLLECTION_PLANTED => 'Planted',
self::COLLECTION_NON_TREE => 'Non Tree',
self::COLLECTION_REPLANTING => 'Replanting',
self::COLLECTION_NURSERY => 'Nursery Seedling',
self::COLLECTION_HISTORICAL => 'Historical Tree Species',
];
Expand Down

0 comments on commit 541bff2

Please sign in to comment.