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

Display warning if editing an audited purchase/donation #4086

Merged
merged 17 commits into from
Feb 16, 2024

Conversation

vincent-truong-dev
Copy link
Contributor

@vincent-truong-dev vincent-truong-dev commented Feb 6, 2024

Closes #4080

Description

Displays a warning on the donation and purchase edit page if there has been an audit on the donation or purchase since their creation.

Type of change

New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Assume logged in

  1. Create a donation and a purchase with an item
  2. Create and finalize audit on said item
  3. Navigate to Purchases edit screen
  4. Navigate to Donation edit screen

Screenshots

Screenshot 2024-02-06 at 3 01 50 PM Screenshot 2024-02-06 at 3 02 00 PM

@vincent-truong-dev vincent-truong-dev force-pushed the display-warning-if-edit branch 3 times, most recently from f08978e to 960a7d6 Compare February 12, 2024 20:03
app/models/audit.rb Outdated Show resolved Hide resolved
spec/system/donation_system_spec.rb Outdated Show resolved Hide resolved
@vincent-truong-dev vincent-truong-dev force-pushed the display-warning-if-edit branch 2 times, most recently from 6a3396c to bc32610 Compare February 14, 2024 01:13
create(:audit, storage_location: storage_location3, line_items_attributes: [{item_id: storage_location3.items.first.id, quantity: 10}])
create(:audit, storage_location: storage_location1, status: "finalized", line_items_attributes: [{item_id: storage_location1.items.first.id, quantity: 5}])
create(:audit, storage_location: storage_location3, status: "finalized", line_items_attributes: [{item_id: storage_location3.items.first.id, quantity: 10}])
create(:audit, storage_location: storage_location5, status: "confirmed", line_items_attributes: [{item_id: storage_location5.items.first.id, quantity: 10}])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added new audit here and an assertion below to account for non-finalized case.

@@ -607,6 +607,56 @@
total_quantity = find("#donation_quantity").text
expect(total_quantity).to eq "0 (Total)"
end

context "when an finalized audit has been performed on the donated items" do
Copy link
Collaborator

Choose a reason for hiding this comment

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

All 3 of these tests should be request tests, not system tests. They're not interactive, so there's no reason to run them in a browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorner converted the system specs into request specs.

@@ -295,6 +295,60 @@
expect(page).to_not have_link("Delete")
end
end

context "when editing an existing purchase" do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorner these are converted now as well

Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Thanks! In the future, please don't force-push your branch so that it's easier to review the new commits.

@dorner dorner merged commit 3ed26db into rubyforgood:main Feb 16, 2024
19 checks passed
@vincent-truong-dev vincent-truong-dev deleted the display-warning-if-edit branch February 16, 2024 20:38
Copy link
Contributor

@vincent-truong-dev: Your PR Display warning if editing an audited purchase/donation is part of today's Human Essentials production release: 2024.02.18.
Thank you very much for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants