Skip to content

Commit 677305a

Browse files
committed
feat(Dashboard\Grid): add all usage impact cards
1 parent 7f57671 commit 677305a

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/Dashboard/Grid.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,19 +268,10 @@ protected static function getReportCards(): array
268268
'label' => __('Biggest monthly averaged carbon emission per model', 'carbon'),
269269
'provider' => Provider::class . '::getSumUsageEmissionsPerModel',
270270
],
271-
'plugin_carbon_report_usage_adp_impact' => [
272-
'widgettype' => ['impact_criteria_number'],
273-
'group' => $group,
274-
'label' => __('Usage abiotic depletion potential', 'carbon'),
275-
'provider' => Provider::class . '::getImpactOfUsageCriteria',
276-
'args' => [
277-
'impact_type' => 'adp',
278-
],
279-
],
280271
];
281272

282-
// Embodied impact
283273
foreach (Type::getImpactTypes() as $impact_type) {
274+
// Embodied impact
284275
$key = "plugin_carbon_report_embodied_{$impact_type}_impact";
285276
if (isset($new_cards[$key])) {
286277
trigger_error("The card $key already exists", E_USER_WARNING);
@@ -294,6 +285,21 @@ protected static function getReportCards(): array
294285
'impact_type' => $impact_type,
295286
],
296287
];
288+
289+
// Usage impact
290+
$key = "plugin_carbon_report_usage_{$impact_type}_impact";
291+
if (isset($new_cards[$key])) {
292+
trigger_error("The card $key already exists", E_USER_WARNING);
293+
}
294+
$new_cards[$key] = [
295+
'widgettype' => ['impact_criteria_number'],
296+
'group' => $group,
297+
'label' => Type::getUsageImpactLabel($impact_type),
298+
'provider' => Provider::class . '::getImpactOfUsageCriteria',
299+
'args' => [
300+
'impact_type' => $impact_type,
301+
],
302+
];
297303
}
298304

299305
// Informational content

0 commit comments

Comments
 (0)