Gitcoin is GDPR complaint. Learn more in
Gitcoin's Terms & Conditions.
Check out the Issue Explorer
Looking to fund some work? You can submit a new Funded Issue here.
**This issue is complete and has been re-opened pending gitcoin resolution**
Diaperbase is a digitized reflection of a physical inventory. While we do take measures to maintain the integrity and accuracy of the data, mistakes can be happen (either on our end or theirs) and the diaperbanks need a means to reconcile what they have in physical space (ie. their storage locations) with what they know about in the digital space (ie. in Diaperbase).
This is a :new: tool, and will require a little bit extra beyond just the feature (it will need to be added to a menu heading that does not yet exist, and some permissions may need to be declared).
# Desired Workflow
*(these steps can, and probably should, be replicated as feature specs)*
- [ ] All functions for Auditing are to be performed by the **Organization Admin**. (This may change later, but for now, this is what we want)
- [ ] The signed-in Organization Admin should go to a section of the site for **Reporting & Auditing**. This tool is for **Annual Audit** specifically.
- [ ] Within that section, the user will select a storage location to audit. With the location selected, prompt the user for `line_items` (cf. `Adjustments#new`). This should allow them to enter things by Barcode or by manually typing a quantity and selecting from an `Item` list.
- [ ] The user is expected to enter **all** of their inventory, so make sure that expectation is clear (we have no way of knowing whether or not they've done anything).
- [ ] The user should be able to save an in progress Audit, and resume an incomplete one (this is expected to be a lengthy process).
- [ ] When the user clicks on the submit button to complete the Audit, they should be prompted with a `confirm` dialog, since the process shouldn't be reversed once it gets to this point.
- [ ] The submitted Audit should present the user with a differential between what was reported and what is known. At this point, the Audit has now been submitted, but is not yet completed.
- [ ] After the user has reviewed this, they can click a final button ("Finalize"?) which will submit the differential and create an `Adjustment` for the differential. The `Adjustment` should include a comment remarking that it was created automatically through the Auditing process.
- [ ] Once an Audit has been finalized, it should be immutable.
- [ ] The user should be able to review all of their audits in any stage of the process
- [ ] The user should be able to delete any Audit that has not yet been finalized.
## Expected Model Changes
- A new `Audit` model will need to be created
- [ ] The `Audit` model should belong to an organization (it will have many audits), but also have a reference to the user that created it
- [ ] The `Audit` model should only have one `Adjustment` (no inverse association)
- [ ] The `Audit` model will need its state tracked -- use your discretion on how to implement this, but I don't think we need to add a gem for this...yet
- [ ] The `Audit` model should mediate its `Item` associations via its associated `Adjustment` (don't attach items directly to the `Audit`; that'll be redundant)
## Expected Controller Changes
- [ ] An `AuditsController` will need to be created, use your judgement about what actions to create for it
- Any XHR modifications to the `Adjustment` that's in-progress should be done against the `AdjustmentsController`
## Expected View / UI Changes
N.B. Please be sure to refer to `/app/helpers/ui_helper.rb` and the [Styleguide Wiki](https://github.com/rubyforgood/diaper/wiki/Styleguide) when building your views. The `UiHelper` will ensure consistent UI across the site.
- [ ] Create a new navigation section in the standard nav for "Reporting & Auditing", give that menu item the `fa-tasks` icon, if that's not already in use
- [ ] Create a submenu item for this tool, called "Annual Audit"
- [ ] New views for this resource will need to be created, as needed
## Expected Routing changes
- It might make sense to nest an `Adjustment` resource under the `Audit`, that's probably fine -- your call
# Criteria for Completion
- The feature works as described by the desired workflow, above
- There is test coverage for each of the items marked with checkboxes
- The test suite passes
- Rubocop passes (running `rubocop -a` is totally fine and will save you lots of time :) )
# Reference / History
This is a clean up of #266