Index>
20140827-fix-fachinfo-search
Summary
- Make extended fachinfo search work again.
Commits
Index
- Keep in Mind
-
- Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
- I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
- The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
- One unit-test for searchbar fails and might be a clue why searching does not work correctly.
- Added two skip in test/test_plugin/rss.rb. Why does the mocking not work there anymore?
- Make ext/swissindex/test/test_swissindex.rb and skipping tests in migel-gem pass.
---
Make extended fachinfo search work again
Adding several drugs to the fachinfo_search view, works, but searching for a chapter resets URL to home.
Here some findings from my investigations:
- Open "FI erweitert"
- After entering an ean13 the method in src/view/searchbar.rb InstantSearchBarMethods.to_html gets fired and loads a new URL via an XHR request. Here we must correct the way how choosen drugs pass their values to
- State::Ajax::Matches. Before my refactoring they were passed by the persistent_user_input(:drugs). For prescription and home_interactions I added them to the URL. Concats all search_terms into @model.
- View::Ajax::Json where the to_html method retruns @model.to_json
- Then in java console I see "http://oddb-ci2.dyndns.org/de/gcc/ajax_matches/index_name/oddb_package_name_with_size_company_name_ean13_fi/?search_query=aspir".
I think I should use here a different persistent_user_input variable, e.g. :fachinfo_drugs_2_search. This had worked quite well for the CSV export of a prescription.
But first I think I must create watir tests for all views where the SearchForm is used to see which still work and which do not work. grep -wr SearchForm src/
found the following occurences
- src/view/notify.rb
- src/view/migel/feedbacks.rb
- src/view/notify_confirm.rb
- src/view/drugs/fachinfos.rb
- src/view/drugs/vaccines.rb
- src/view/drugs/limitationtexts.rb
- src/view/drugs/feedbacks.rb
- src/view/drugs/patinfos.rb
- src/view/drugs/sequences.rb
- src/view/drugs/resultlimit.rb
- src/view/searchbar.rb
- src/view/privatetemplate.rb
- src/view/substances/result.rb
As Zeno remarked most of these searches do not use the Ajax-Interface. Therefore marked them all as pending (except the search inside the fachinfo). Now thinking about removing src/state/ajax/matches.rb. But what about SwissmedicCat, DDDChart and DDDPriceTable? And how to I reach these searches? Seem to come from additional_information. Therefore changing the URL only when fachinfo_search is active.
But my first try is not good. When the URL does not contain a search_query then I get in the Javs-Console the following error dijit.form.ComboBox SyntaxError: Unexpected token < _SearchMixin.js:101
. Therefore trying to merge fachinfo_search and search_query into the URL. Merging does not work neither, as I get just another syntax errors in dojo.js or _SearchMixin.js. Looking at its manual under http://bill.dojotoolkit.org/api/1.9/dijit/form/_SearchMixin
Okay. Now it kind of works. Adding "Actembra" as a drug, selecting full fachinfo chapter text, adding "Kopfschmerzen" as search term an pressing "Suchen" displays now the fachinfo chapter. See
The following stuff must be corrected next week:
- Deleting a drug does not work
- Should selected drugs be visible in the result window?
- Why does simulating clicking the "Suchen" button not work under watir?
- More extensive tests.
Saving the diff as Attach:Fachinfo-search-patch.txt