Comments (6)
We are going to roll this into the packs-8 task which is part of our event this weekend! Thanks for taking an initial look at it @danielabar.
from human-essentials.
re: User selects an Item but does not enter a quantity, then the entire line item is skipped:
I believe this behaviour is due to the use of ||
rather than &&
in the reject_if
option of accepts_nested_attributes_for :line_items
in the Itemizable
concern, code:
accepts_nested_attributes_for :line_items,
allow_destroy: true,
reject_if: proc { |l| l[:item_id].blank? || l[:quantity].blank? }
This says if either item id (i.e. a selected item) or quantity are blank, then do not associate the line item with this Itemizable (Donation, Distribution, etc).
Changing the ||
to &&
will change this behaviour to only skip associating the line item if both of these are blank. But if either one is provided, then it will associate, and run the line items validation. (found this when investigating the Safari quantity issue).
Note that since Itemizable is used in several entities, changing this behaviour in the concern will affect affect all of these models:
app/models/adjustment.rb:
21: include Itemizable
app/models/audit.rb:
22: include Itemizable
app/models/distribution.rb:
32: include Itemizable
app/models/donation.rb:
36: include Itemizable
app/models/kit_allocation.rb:
15: include Itemizable
app/models/kit.rb:
16: include Itemizable
app/models/purchase.rb:
29: include Itemizable
app/models/transfer.rb:
20: include Itemizable
This will also require a number of system tests to be updated to now expect validation errors (or fill in a quantity). Because there are some tests that do not provide a quantity, but if its one of the models that automatically have the first item selected, currently its allowed to be saved, but with this change, it will return a validation error unless quantity is also selected.
from human-essentials.
I could pick this up if it hasn't been assigned yet.
from human-essentials.
@danielabar It's been identified as a blocker for some of the issues for the event at the end of the month -- just checking your confidence in getting it addressed in that timeframe -- otherwise we'll slot it for the event. (don't know if you're going)
from human-essentials.
Not sure if I'd be able to finish it in the next week or so, (I won't be attending the event). If its needed in a hurry, might be better to assign to someone who has more time this week.
from human-essentials.
@awwaiid, @scooter-dangle Do we want to keep this as a separate issue to be addressed at or before the event, or just roll it in to "PACKS #8"?
from human-essentials.
Related Issues (20)
- [PACKS] #5 Add custom request units (if any) to the confirmation email for partner requests. HOT 1
- [PACKS] # 6 Add custom request units to partner's request list HOT 7
- [PACKS] # 7 Show custom request units in banks' request view
- [PACKS] #8 New / Edit Distribution for the banks shows custom request units, if applicable
- [PACKS] # 9 Distribution printout for banks includes custom request units, if applicable
- [PACKS] #10 Add custom request units to Request export
- [PACKS] 11: Add ability to print all outstanding requests as pick-lists
- [PACKS] #12 Item view should include all fields (including new custom request units) HOT 4
- [PACKS] #13 Calcuate Product Totals
- Bank Request View -- only show fulfillment column if partner has default location
- Account requests and org websites HOT 2
- [BUG]: rspec tests fail in fresh virtual machine dev environments
- Bug: Inventory levels by date with read_events enabled doesn't work before snapshot
- Remove the ability for the superuser to delete users
- Add number of disposable diapers purchased to annual report HOT 2
- Storage Location on purchase and donation should default to the Default Intake Location
- [BUG] if you have an error in defining a kit, the information you entered is not preserved. It should be.
- Distribution, New. Add Another Item should be activated when storage location chosen, after error.
- Clean up distribution print
- Autoscrolling when adding new items in donations/distributions/purchases HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from human-essentials.