Commit c5bce484 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

ResourcMeasureConsistencyConstraint: Update Constraint

parent 5c4de8cd
...@@ -64,6 +64,7 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin): ...@@ -64,6 +64,7 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin):
quantity_map = {} quantity_map = {}
metric_type_set = set() metric_type_set = set()
quantity_unit_definition_dict = obj._getQuantityUnitDefinitionDict()
for measure in obj.getMeasureList(): for measure in obj.getMeasureList():
metric_type = measure.getMetricType() metric_type = measure.getMetricType()
...@@ -78,7 +79,7 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin): ...@@ -78,7 +79,7 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin):
if not measure.getConvertedQuantityUnit(): if not measure.getConvertedQuantityUnit():
error('message_measure_no_quantity_unit', error('message_measure_no_quantity_unit',
metric_type=display(metric_type, 'metric_type')) metric_type=display(metric_type, 'metric_type'))
elif not measure.asCatalogRowList(): elif not measure.asCatalogRowList(quantity_unit_definition_dict):
error('message_measure_no_quantity', error('message_measure_no_quantity',
metric_type=display(metric_type, 'metric_type')) metric_type=display(metric_type, 'metric_type'))
if metric_type in metric_type_set: if metric_type in metric_type_set:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment