Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions src/Dashboard/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,10 @@ protected static function getReportCards(): array
'label' => __('Biggest monthly averaged carbon emission per model', 'carbon'),
'provider' => Provider::class . '::getSumUsageEmissionsPerModel',
],
'plugin_carbon_report_usage_adp_impact' => [
'widgettype' => ['impact_criteria_number'],
'group' => $group,
'label' => __('Usage abiotic depletion potential', 'carbon'),
'provider' => Provider::class . '::getImpactOfUsageCriteria',
'args' => [
'impact_type' => 'adp',
],
],
];

// Embodied impact
foreach (Type::getImpactTypes() as $impact_type) {
// Embodied impact
$key = "plugin_carbon_report_embodied_{$impact_type}_impact";
if (isset($new_cards[$key])) {
trigger_error("The card $key already exists", E_USER_WARNING);
Expand All @@ -294,6 +285,21 @@ protected static function getReportCards(): array
'impact_type' => $impact_type,
],
];

// Usage impact
$key = "plugin_carbon_report_usage_{$impact_type}_impact";
if (isset($new_cards[$key])) {
trigger_error("The card $key already exists", E_USER_WARNING);
}
$new_cards[$key] = [
'widgettype' => ['impact_criteria_number'],
'group' => $group,
'label' => Type::getUsageImpactLabel($impact_type),
'provider' => Provider::class . '::getImpactOfUsageCriteria',
'args' => [
'impact_type' => $impact_type,
],
];
}

// Informational content
Expand Down