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

Add row for grand totals to storage locations index view #4768

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tatheerf02
Copy link
Contributor

@tatheerf02 tatheerf02 commented Nov 9, 2024

Resolves #4520

Description

Display another row at the bottom of the storage locations index that aggregates the total inventory quantity and dollar value across all locations, taking into account any filters applied.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added a new system test that ensures the row is displayed on the index with the correct total values.

Updates existing tests to account for the new row in the table

Screenshots

📸 Storage locations index (no filters) Screen Shot 2024-11-09 at 11 53 47 AM
📸 Storage locations index (with filters) Screen Shot 2024-11-09 at 12 05 57 PM

Comment on lines +94 to +100
def inventory_total_quantity(inventory = nil)
if inventory
inventory.quantity_for(storage_location: id)
else
size
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted this conditional to a method in the model to prevent duplication between the ERB files - do we like this approach?

Comment on lines +106 to +109
within "tbody tr:last-child" do
expect(page).to have_content(100) # The expected total inventory
expect(page).to have_content("$100.00") # The expected total fair market value
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a better way to test the totals show up as expected without writing a system test?

@tatheerf02 tatheerf02 marked this pull request as ready for review November 10, 2024 17:21
@cielf cielf requested review from dorner and cielf November 12, 2024 15:57
Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Hey @tatheerf02 -- I'm noticing that the totals are not aligned with the inventory and fair market value -- I expect that the values for each storage location are not right-aligned as they should be.

Can you take care of that? It fits here, but I can put it to a new issue if need be.

@tatheerf02
Copy link
Contributor Author

Hey @tatheerf02 -- I'm noticing that the totals are not aligned with the inventory and fair market value -- I expect that the values for each storage location are not right-aligned as they should be.

Can you take care of that? It fits here, but I can put it to a new issue if need be.

Hey @cielf! Sorry I'm a lil confused, I see that all column values are currently left-aligned, and the grand totals follow that pattern. Are you suggesting they should all be right-aligned instead? Thanks!

@cielf
Copy link
Collaborator

cielf commented Nov 13, 2024

Hey @cielf! Sorry I'm a lil confused, I see that all column values are currently left-aligned, and the grand totals follow that pattern. Are you suggesting they should all be right-aligned instead? Thanks!

@tatheerf02 Yup -- that's exactly what I'm suggesting. Thank you.

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.

Add totals for inventory and FMV to storage locations index page.
2 participants