Skip to content

Commit

Permalink
fix: remove generation only zones from ranking (#6999)
Browse files Browse the repository at this point in the history
* fix: remove generation only zones from ranking

* ensure only boolean output
  • Loading branch information
VIKTORVAV99 authored Jul 22, 2024
1 parent 6a5ceba commit cc3d7de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/src/features/panels/ranking-panel/getRankingPanelData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { GridState, ZoneKey } from 'types';
import { SpatialAggregate } from 'utils/constants';
import { getCO2IntensityByMode } from 'utils/helpers';

import { getHasSubZones } from '../zone/util';
import { getHasSubZones, isGenerationOnlyZone } from '../zone/util';
import { ZoneRowType } from './ZoneList';

function filterZonesBySpatialAggregation(
Expand Down Expand Up @@ -63,7 +63,8 @@ export const getRankedState = (
.filter(
(zone) =>
Boolean(zone.co2intensity) &&
filterZonesBySpatialAggregation(zone.zoneId, spatialAggregation)
filterZonesBySpatialAggregation(zone.zoneId, spatialAggregation) &&
!isGenerationOnlyZone(zone.zoneId)
);

const orderedZones =
Expand Down
3 changes: 3 additions & 0 deletions web/src/features/panels/zone/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ export function showEstimationFeedbackCard(
}
return false;
}

export const isGenerationOnlyZone = (zoneId: string): boolean =>
config.zones[zoneId]?.generation_only ?? false;

0 comments on commit cc3d7de

Please sign in to comment.