Skip to content

Commit 5b4155b

Browse files
committed
Got the Project Moves chart working
Signed-off-by: Chris Abraham <[email protected]>
1 parent 4132e5c commit 5b4155b

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

web/wp-content/themes/cncf-twenty-two/includes/shortcodes/project-charts.php

+16-12
Original file line numberDiff line numberDiff line change
@@ -262,30 +262,34 @@ function add_project_moves_chart_shortcode( $atts ) {
262262
$current_year = (int) gmdate( 'Y' );
263263

264264
for ( $this_year = $start_year; $this_year <= $current_year; $this_year++ ) {
265-
$archived_move[ $this_year ] = 0;
265+
$archived_move[ $this_year ] = 0;
266266
$incubating_move[ $this_year ] = 0;
267267
$graduated_move[ $this_year ] = 0;
268268
if ( $current_year == $this_year ) {
269269
$graduated_background[] = 'rgb(193, 96, 220, .4)';
270270
$incubating_background[] = 'rgb(240, 188, 0, .4)';
271-
$archived_background[] = 'rgb(116, 116, 116, .4)';
271+
$archived_background[] = 'rgb(116, 116, 116, .4)';
272272
} else {
273273
$graduated_background[] = 'rgb(193 96 220)';
274274
$incubating_background[] = 'rgb(240, 188, 0)';
275-
$archived_background[] = 'rgb(116, 116, 116)';
275+
$archived_background[] = 'rgb(116, 116, 116)';
276276
}
277277
}
278278

279279
foreach ( $maturity_data as $md ) {
280-
$md_year = (int) explode( '-', $md['accepted'] )[0];
281-
if ( 2016 <= $md_year && $md_year <= $current_year ) {
282-
if ( $md['graduated'] == $md['accepted'] ) {
283-
$graduated_move[ $md_year ] += 1;
284-
} elseif ( $md['incubating'] == $md['accepted'] ) {
285-
$incubating_move[ $md_year ] += 1;
286-
} else {
287-
$archived_move[ $md_year ] += 1;
288-
}
280+
$accepted_year = (int) explode( '-', $md['accepted'] )[0];
281+
$graduated_year = (int) explode( '-', $md['graduated'] )[0];
282+
$incubating_year = (int) explode( '-', $md['incubating'] )[0];
283+
$archived_year = (int) explode( '-', $md['archived'] )[0];
284+
285+
if ( 2016 <= $graduated_year && $graduated_year != $accepted_year ) {
286+
$graduated_move[ $graduated_year ] += 1;
287+
}
288+
if ( 2016 <= $incubating_year && $incubating_year != $accepted_year ) {
289+
$incubating_move[ $incubating_year ] += 1;
290+
}
291+
if ( 2016 <= $archived_year && $archived_year != $accepted_year ) {
292+
$archived_move[ $archived_year ] += 1;
289293
}
290294
}
291295

web/wp-content/themes/cncf-twenty-two/source/js/on-demand/project-moves-chart.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ function projectMovesChart() {
2828

2929
const data = {
3030
datasets: [
31-
{
32-
label: 'Sandbox',
33-
data: project_sandbox_accepted_dates,
34-
backgroundColor: chart_sandbox_background_colors
35-
},
3631
{
3732
label: 'Incubating',
38-
data: project_incubating_accepted_dates,
33+
data: project_incubating_move_dates,
3934
backgroundColor: chart_incubating_background_colors
4035
},
4136
{
4237
label: 'Graduated',
43-
data: project_graduated_accepted_dates,
38+
data: project_graduated_move_dates,
4439
backgroundColor: chart_graduated_background_colors
4540
},
41+
{
42+
label: 'Archived',
43+
data: project_archived_move_dates,
44+
backgroundColor: chart_archived_background_colors
45+
},
4646
]
4747
};
4848

@@ -75,7 +75,7 @@ function projectMovesChart() {
7575
y: {
7676
title: {
7777
display: true,
78-
text: 'Projects Accepted into CNCF'
78+
text: 'Projects Moves into Tier'
7979
},
8080
stacked: true
8181
},

0 commit comments

Comments
 (0)