-
Notifications
You must be signed in to change notification settings - Fork 25
Fix distributing pricing service cost when there is lack of some daily usages #652
Conversation
…y usages When pricing service has multiple services (for distributing cost) and not every DailyUsage is present (see #648 - ignoring zero-value usage) costs were not distributed properly. It was caused by storying usage values for single service environment on lists - these lists have different size and when accessing by index (and using `zip` to join this list with total usage and percentage for usage type) usage value was combined with wrong total usage and percentage.
# create hierarchy basing on usages | ||
for (po, se), po_usages in usages.items(): | ||
po_usages_info = zip(po_usages, total_usages, percentage) | ||
po_usages_info = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does po mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, IMO using full names for po
, ut
, se
would be more readable for future us ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure - i've expanded all abbreviations here
po_usages_info = zip(po_usages, total_usages, percentage) | ||
po_usages_info = [ | ||
(value, total_usages[ut_id], percentage[ut_id]) | ||
for ut_id, value in po_usages.items() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does ut mean? usage_type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes - it's explained now
When pricing service has multiple services (for distributing cost) and
not every DailyUsage is present (see #648 - ignoring zero-value usage)
costs were not distributed properly. It was caused by storying usage
values for single service environment on lists - these lists have
different size and when accessing by index (and using
zip
tojoin this list with total usage and percentage for usage type)
usage value was combined with wrong total usage and percentage.