Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix distributing pricing service cost when there is lack of some daily usages #652

Merged
merged 2 commits into from
Dec 5, 2018

Conversation

mkurek
Copy link
Contributor

@mkurek mkurek commented Dec 4, 2018

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.

…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.
@coveralls
Copy link

coveralls commented Dec 4, 2018

Coverage Status

Coverage increased (+0.003%) to 76.734% when pulling 39e4b8e on fix-distribute-costs-for-incomplete-usages into 1e0b14c on develop.

# 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 = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does po mean?

Copy link
Collaborator

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 ;)

Copy link
Contributor Author

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()
Copy link
Contributor

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?

Copy link
Contributor Author

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

@mkurek mkurek merged commit 12831ea into develop Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants