CivicActions / nebula

Other
3 stars 5 forks source link

Drug Limit? Drug disappeared #74

Closed rakanowicz closed 9 years ago

rakanowicz commented 9 years ago

Enter the list of drugs in image. Then I added Motrin. It was added to the list and then when I clicked in the field to enter another drug Motrin disappeared. Now it doesn't accept another drug. Is there a limit?

image

When I clicked back in the drug field Motrin disappeared: image

ethanteague commented 9 years ago

@RobertLRead | @grugnog: Gonna need some extra eyes on this - sure I'm missing the obvious, but inside of the ajax function error callbacks, I'm saying that if a sessionStorage item doesn't match a checkbox, remove it. This logic is causing things to be eaten, randomly. I've not been able to modify this with success. If I remove, then junk terms can get through. Strangely, this random munching of data only occurs after 6 or 7 entries. I've tried using setTimeout functions around the remove to give the sessionStorage items to be built, but no luck. I'm 4 hours into this task, so I'm gonna have to set it down, as time is tight.

RobertLRead commented 9 years ago

@ethanteague @grugnog Okay I think we can partially reprioritize this. One thing I am worried about is that I believe in haste I coded on an N-squared or N-cubed algorithm based on the number of drugs. When the you et 6 or 7 drugs, it becomes slow and unresponsive. It is hard to separate that weirdeness from the duplicative weirdness. I think i will try improving the efficiency of my loops...

grugnog commented 9 years ago

@RobertLRead rather than try and optimize the code, I am wondering if it might be simpler to do a little more work on the backend (as we originally planned, I think). I think it would be very simple to aggregate data from both FCC and AHRQ on the backend into a single JSON structure. That way it would only require a single AJAX callback, and I am guessing the need for the looping and session storage stuff would all go away (the performance issues would, at the very least). It's a little risky at this stage, but it seems like it would simplify quite a lot. If you can put together a sample of what the "ideal" JSON structure would be on the front end I can have a quick play on a branch and see if I can get it working tonight.