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

Update availability percentage calculation for expansion lookups #56

Closed
mohit-s96 opened this issue Apr 16, 2024 · 0 comments · Fixed by #57
Closed

Update availability percentage calculation for expansion lookups #56

mohit-s96 opened this issue Apr 16, 2024 · 0 comments · Fixed by #57
Assignees
Labels
bug Something isn't working

Comments

@mohit-s96
Copy link
Member

mohit-s96 commented Apr 16, 2024

We use the proper expanded counts for expansion fields:

const availability = field?.frequency && count ? (1.0 * field.frequency) / count : 0.0;

but this needs to be updated for the expansion lookups as well:
lookupValue?.frequency && resourceCounts[resourceName] ? (1.0 * lookupValue.frequency) / resourceCounts[resourceName] : 0.0;

We should be using count that is calculated based on whether the field is an expansion or not:

const count = parentResourceName ? expandedResourcesCounts[parentResourceName]?.[resourceName] : resourceCounts[resourceName];

cc: @darnjo

@mohit-s96 mohit-s96 added the bug Something isn't working label Apr 16, 2024
@mohit-s96 mohit-s96 self-assigned this Apr 16, 2024
mohit-s96 added a commit that referenced this issue Apr 16, 2024
darnjo pushed a commit that referenced this issue Apr 16, 2024
…#57)

* #56: update tests

* #56: update with proper expansion counts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant