-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
base: main
Are you sure you want to change the base?
Add row for grand totals to storage locations index view #4768
Conversation
9dc61f2
to
751fa34
Compare
751fa34
to
a46bd92
Compare
def inventory_total_quantity(inventory = nil) | ||
if inventory | ||
inventory.quantity_for(storage_location: id) | ||
else | ||
size | ||
end | ||
end |
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.
Extracted this conditional to a method in the model to prevent duplication between the ERB files - do we like this approach?
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 |
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.
Is there a better way to test the totals show up as expected without writing a system test?
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.
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! |
@tatheerf02 Yup -- that's exactly what I'm suggesting. Thank you. |
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
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)
📸 Storage locations index (with filters)