Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ab9e2cd
docs: source if yearly carbon intensity per country
btry Feb 11, 2026
0926027
feat(Embodied\Impact): support for all criterias of Boaviztapi
btry Feb 11, 2026
ad2a1e9
feat(Embodied\Impact): cards for all embodied impacts
btry Feb 16, 2026
1dd0625
feat(Embodied\Impact): add widgets for new impacts
btry Feb 16, 2026
e53b243
style: code style
btry Feb 16, 2026
dd0c607
fix(Install): method always return true
btry Feb 16, 2026
c2a7925
fix(Install): follow stricter lint checks
btry Feb 16, 2026
afae034
feat(EmbodiedImpact): add search options
btry Feb 16, 2026
860c6c3
fix(Impact\Type): better unit notation
btry Feb 16, 2026
c22ae21
fix: code lint
btry Feb 16, 2026
6c76cf8
fix(Type): search option construction
btry Feb 16, 2026
0d65672
refactor: unify embodied impact cards for report page
btry Feb 20, 2026
1331656
Install: update reporting page configuration
btry Feb 24, 2026
6846248
feat(Dashboard\DemoProvider): update
btry Feb 24, 2026
4fbf453
feat(Dashboard\Grid): extend usage and total widgets to all criteria
btry Feb 25, 2026
18550ce
refactor(Dashboard): mutualize template for number widget
btry Feb 25, 2026
0bbbf82
refactor(Dashboard\Grid): code optimization
btry Feb 25, 2026
20a95ca
feat(Install): add new criterias for usage impact
btry Feb 25, 2026
20e31d5
feat(Impact\Embodied): handle recalculate flag
btry Feb 26, 2026
f356f2b
fix(Impact): engine and version of calculations
btry Feb 26, 2026
89a88e3
feat: show all individual impacts
btry Feb 27, 2026
6a0e19a
refactor(AbstractImpact): factorize code from embodied and usage impact
btry Feb 27, 2026
62acf64
style: various code style fixes
btry Feb 27, 2026
2127630
refactor(UsageInfo): code cleanup
btry Mar 2, 2026
18ddde9
feat: update and reorganize search options
btry Mar 3, 2026
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
9 changes: 8 additions & 1 deletion install/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,18 @@ public function install(array $args = []): bool
global $DB;

$dbFile = plugin_carbon_getSchemaPath();
if ($dbFile === null || !$DB->runFile($dbFile)) {
if ($dbFile === null) {
$this->migration->addWarningMessage("Error creating tables : " . $DB->error());
return false;
}

try {
$DB->runFile($dbFile);
} catch (\RuntimeException $e) {
$this->migration->addWarningMessage("Error creating tables : " . $e->getMessage());
return false;
}

// Execute all install sub tasks
$install_dir = __DIR__ . '/install/';
$update_scripts = scandir($install_dir);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Data source:
https://ourworldindata.org/grapher/carbon-intensity-electricity
10 changes: 5 additions & 5 deletions install/data/report_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,27 @@
"point_labels": "0"
}
},
"plugin_carbon_report_embodied_abiotic_depletion": {
"plugin_carbon_report_embodied_adp_impact": {
"x": 5,
"y": 3,
"width": 5,
"height": 3,
"card_options": {
"color": "#ffd966",
"widgettype": "embodied_abiotic_depletion",
"widgettype": "impact_criteria_number",
"use_gradient": "0",
"point_labels": "0",
"limit": "7"
}
},
"plugin_carbon_report_embodied_global_warming": {
"plugin_carbon_report_embodied_gwp_impact": {
"x": 10,
"y": 0,
"width": 5,
"height": 3,
"card_options": {
"color": "#7a941e",
"widgettype": "embodied_global_warming",
"widgettype": "impact_criteria_number",
"use_gradient": "0",
"point_labels": "0",
"limit": "7"
Expand All @@ -110,7 +110,7 @@
"height": 3,
"card_options": {
"color": "#326319",
"widgettype": "embodied_primary_energy",
"widgettype": "impact_criteria_number",
"use_gradient": "0",
"point_labels": "0",
"limit": "7"
Expand Down
44 changes: 22 additions & 22 deletions install/install/init_datasources.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@
Install::linkSourceZone($source_id, $zone_id, $code);

// Insert into the database
$success = $DB->updateOrInsert($table, [
'intensity' => $intensity,
'data_quality' => 2 // constant GlpiPlugin\Carbon\DataTracking::DATA_QUALITY_ESTIMATED
], [
'date' => "$year-01-01 00:00:00",
'plugin_carbon_sources_id' => $source_id,
'plugin_carbon_zones_id' => $zone_id,
]);

if ($success === false) {
try {
$DB->updateOrInsert($table, [
'intensity' => $intensity,
'data_quality' => 2 // constant GlpiPlugin\Carbon\DataTracking::DATA_QUALITY_ESTIMATED
], [
'date' => "$year-01-01 00:00:00",
'plugin_carbon_sources_id' => $source_id,
'plugin_carbon_zones_id' => $zone_id,
]);
} catch (\RuntimeException $e) {
$file = null; // close the file
throw new \RuntimeException("Failed to insert data for year $year");
throw new \RuntimeException("Failed to insert data for year $year; reason: " . $e->getMessage(), $e->getCode(), $e);
}
}
if ($progress_bar) {
Expand All @@ -129,17 +129,17 @@

$quebec_carbon_intensity = include(dirname(__DIR__) . '/data/carbon_intensity/quebec.php');
foreach ($quebec_carbon_intensity as $year => $intensity) {
$success = $DB->updateOrInsert($table, [
'intensity' => $intensity,
'data_quality' => 2 // constant GlpiPlugin\Carbon\DataTracking::DATA_QUALITY_ESTIMATED
], [
'date' => "$year-01-01 00:00:00",
'plugin_carbon_sources_id' => $source_id,
'plugin_carbon_zones_id' => $zone_id_quebec,
]);

if ($success === false) {
try {
$DB->updateOrInsert($table, [
'intensity' => $intensity,
'data_quality' => 2 // constant GlpiPlugin\Carbon\DataTracking::DATA_QUALITY_ESTIMATED
], [
'date' => "$year-01-01 00:00:00",
'plugin_carbon_sources_id' => $source_id,
'plugin_carbon_zones_id' => $zone_id_quebec,
]);
} catch (\RuntimeException $e) {
$file = null; // close the file
throw new \RuntimeException("Failed to insert data for year $year");
throw new \RuntimeException("Failed to insert data for year $year; reason: " . $e->getMessage(), $e->getCode(), $e);
}
}
8 changes: 7 additions & 1 deletion install/migration/update_1.0.0_to_1.0.1.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ function update100to101(Migration $migration)
}

$dbFile = plugin_carbon_getSchemaPath($to_version);
if ($dbFile === null || !$DB->runFile($dbFile)) {
if ($dbFile === null) {
$migration->addWarningMessage("Error creating tables : " . $DB->error());
$updateresult = false;
}
try {
$DB->runFile($dbFile);
} catch (\RuntimeException $e) {
$migration->addWarningMessage("Error creating tables : " . $e->getMessage());
$updateresult = false;
}

// ************ Keep it at the end **************
$migration->executeMigration();
Expand Down
9 changes: 8 additions & 1 deletion install/migration/update_1.0.1_to_1.1.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ function update101to110(Migration $migration)
}

$dbFile = plugin_carbon_getSchemaPath($to_version);
if ($dbFile === null || !$DB->runFile($dbFile)) {
if ($dbFile === null) {
$migration->addWarningMessage("Error creating tables : " . $DB->error());
$updateresult = false;
}
try {
$DB->runFile($dbFile);
} catch (\RuntimeException $e) {
$migration->addWarningMessage("Error creating tables : " . $e->getMessage());
$updateresult = false;
}


// ************ Keep it at the end **************
$migration->executeMigration();
Expand Down
9 changes: 8 additions & 1 deletion install/migration/update_1.1.1_to_1.2.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ function update111to120(Migration $migration)
}

$dbFile = plugin_carbon_getSchemaPath($to_version);
if ($dbFile === null || !$DB->runFile($dbFile)) {
if ($dbFile === null) {
$migration->addWarningMessage("Error creating tables : " . $DB->error());
$updateresult = false;
}
try {
$DB->runFile($dbFile);
} catch (\RuntimeException $e) {
$migration->addWarningMessage("Error creating tables : " . $e->getMessage());
$updateresult = false;
}


// ************ Keep it at the end **************
$migration->executeMigration();
Expand Down
Loading
Loading