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
IN PROGRESS Barcode ajax #119
Conversation
… rapid input from barcodes. Oh yeah, Turbolinks is dead.
…ng). Adds .combine! method to the line_items association in Donation, that combines all line_items with the same item_id. There's spec coverage for it too, at both model and feature levels. Barcode entry now works a lot more as you would expect!
Fixes #21 This is ready to be reviewed, @seanmarcia @cattywampus |
I'll review tonight unless someone else beats me to it! |
Wicked!
…On Wed, Aug 9, 2017 at 4:03 PM Sean Marcia ***@***.***> wrote:
I'll review tonight unless someone else beats me to it!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#119 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAeqWwGiGKeLgvR3StRIOeKIdUVB-QTEks5sWhCngaJpZM4OglPn>
.
|
…emove if there is an empty line item. This way if they are scanning in things they dont have to make sure to remove the empty created one from the bar code scanner.
… and transfers too.
LGTM! I added in a couple tweaks for bar code scanning so it doesn't error out if there is an empty line item at the end. (The line item that would be create from the bar code scanner. |
Also, I commented out a test that I don't think we need anymore. By adding in the proc to reject line_items before they are even created I don't think we need this anymore:
The proc on
|
Now that I think about it, maybe it should be: |
I re-added the spec -- it was failing because when the line item is rejected, the resulting form has zero line items while still displaying an error message. I just re-added a "line_items.build" to the error block if it has no line_items and that fixed the problem. |
👍 |
To test it:
Go to /donations/new - put the mouse in the really wide field and enter a barcode string (a bunch of numbers) and press enter. Alternately just use an actual barcode reader.
Watch the console log for output.
Weird behavior:
The first time you try using it, it won't do anything, but the second time (when it shows error messages) it will work. Not sure why it's doing this.
the
data
object that gets returned should have the@barcode_item.to_json
in it, but I don't see that coming up in the inspector.TODO:
wire up success / failure functions to hook into the workflow. Ideally, this whole process should be generalized enough that we can drop it in for
Donation
,Distribution
,Transfer
,Adjustment
s