Skip to content

Commit 6296377

Browse files
committed
Remove redundant check and revert other check
1 parent 4db10ec commit 6296377

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/graph.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::commodity::{CommodityID, CommodityMap, CommodityType};
33
use crate::process::{ProcessID, ProcessMap};
44
use crate::region::RegionID;
55
use crate::time_slice::{TimeSliceInfo, TimeSliceLevel, TimeSliceSelection};
6-
use crate::units::Dimensionless;
6+
use crate::units::{Dimensionless, Flow};
77
use anyhow::{Context, Result, anyhow, ensure};
88
use indexmap::IndexSet;
99
use itertools::{Itertools, iproduct};
@@ -198,12 +198,10 @@ fn prepare_commodities_graph_for_validation(
198198
// NOTE: we only do this for commodities with the same time_slice_level as the selection
199199
let demand_node_index = filtered_graph.add_node(GraphNode::Demand);
200200
for (commodity_id, commodity) in commodities {
201-
if time_slice_selection.level() == commodity.time_slice_level
202-
&& commodity.demand.contains_key(&(
203-
region_id.clone(),
204-
year,
205-
time_slice_selection.clone(),
206-
))
201+
if commodity
202+
.demand
203+
.get(&(region_id.clone(), year, time_slice_selection.clone()))
204+
.is_some_and(|&v| v > Flow(0.0))
207205
{
208206
let commodity_node = GraphNode::Commodity(commodity_id.clone());
209207
let commodity_node_index = filtered_graph

0 commit comments

Comments
 (0)