Skip to content

Commit

Permalink
clean conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
lastminutediorama committed Dec 20, 2024
1 parent c9b949d commit cac3e09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,18 @@ export class ChangeOverTimeChartComponent implements OnInit {
labels: [0, 5, 10, 15, 20],
datasets: [
{
label: data['blue'][0].variable,
data: data['blue'].map((d) => d.avg_value),
backgroundColor: SLOT_COLORS['blue'],
},
{
label: data['purple'][1].variable,
data: data['purple'].map((d) => d.avg_value),
backgroundColor: SLOT_COLORS['purple'],
},
{
label: data['orange'][2].variable,
data: data['orange'].map((d) => d.avg_value),
backgroundColor: SLOT_COLORS['orange'],
},
{
label: data['green'][3].variable,
data: data['green'].map((d) => d.avg_value),
backgroundColor: SLOT_COLORS['green'],
},
Expand Down Expand Up @@ -203,6 +199,7 @@ export class ChangeOverTimeChartComponent implements OnInit {
): Record<ImpactsMetricSlot, ChangeOverTimeChartItem[]> {
const chartData = resultData.map((d) => {
return {
// map the returned data to data attributes for the map
year: d.relative_year,
avg_value: d.delta * 100,
variable: d.variable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ export class DirectImpactsComponent implements OnInit, OnDestroy {

availableProjectAreas$ = this.treatmentsState.summary$.pipe(
map((summary) => {
// TODO: can remove this, in favor of using natsort on backend,
// so "project area 1", "project area 10", "project area 2"
// are sorted in semantic ways
return summary?.project_areas.sort(
(a, b) => a.project_area_id - b.project_area_id // TODO: maybe semantic sort on backend?
(a, b) => a.project_area_id - b.project_area_id
);
})
);
Expand Down

0 comments on commit cac3e09

Please sign in to comment.