Skip to content

Commit fff2385

Browse files
authored
Merge pull request #30 from stat-kwon/master
Add validation code of cost when it doesn't exist in csv file
2 parents e92aa3e + 6543a50 commit fff2385

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/cloudforet/cost_analysis/manager/cost_manager.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def _make_cost_data(self, results):
4646
if not self._convert_cost_and_usage_quantity_types(result):
4747
continue
4848

49+
if not self._exist_cost_and_usage_quantity(result):
50+
continue
51+
4952
self._check_required_fields(result)
5053

5154
try:
@@ -141,6 +144,13 @@ def _convert_cost_and_usage_quantity_types(result):
141144
return False
142145
return True
143146

147+
@staticmethod
148+
def _exist_cost_and_usage_quantity(result):
149+
if result['cost'] or result['usage_quantity']:
150+
return True
151+
else:
152+
return False
153+
144154
@staticmethod
145155
def _check_required_fields(result):
146156
for field in _REQUIRED_FIELDS:

0 commit comments

Comments
 (0)