(Search prefs branch)
Must have a close look on how the src/model/search_result.rb handles the package_count. Also the AtcFacade maintains a local copy of packages, which does NOT work exactly as the packages (active, public) from the AtcClass.
Is it a good idea to filter the packages when the AtcFacade is created? Probably yes. Also we might distinguish between a sequence_filter (like for the LNF) and a package_filter (which) we would need now.
Trying this approach.
Looking for non public packages via bin/admin
ch.oddb> packages.size -> 23200 ch.oddb> packages.find_all{|x| !x.public?}.size -> 4842 ch.oddb> packages.find_all{|x| !x.public?}.first.pointer -> :!registration,42049!sequence,01!package,018. ch.oddb> packages.find_all{|x| !x.public?}.last.pointer -> :!registration,46470!sequence,01!package,028. ch.oddb> packages.find_all{|x| !x.public?}.last.out_of_trade -> true ch.oddb> packages.find_all{|x| !x.public?}.first.out_of_trade -> true ch.oddb> packages.find_all{|x| !x.public?}.collect{|x| !x.out_of_trade}.size -> 4842
Conclusion: All non public packages are also out_of_trade.
This looked nice, but now the method atc_sorted is called and now the atc_facades are messed up and cannot be compared as expected. Found the culprit. The sequence_filter messed up the @atc_facades attribute.
Finding expired registrations
ch.oddb> registrations.values.find_all{ |x| x.expired?}[-10].name_base -> Salviaben ch.oddb> registrations.values.find_all{ |x| x.expired?}[-10].iksnr -> 65481 ch.oddb> registrations.values.find_all{ |x| x.expired?}[-10].inactive_date -> 2017-09-07 ch.oddb> ch.oddb> registrations.values.find_all{ |x| x.expired?}.last.inactive_date -> 2013-10-24 -> #<ODDB::Registration:0x007ff47c87cfd0> ch.oddb> registrations.values.find_all{ |x| x.expired?}.last.name_base -> Sanukehl® Staph D5, Injektionslösung ch.oddb> registrations.values.find_all{ |x| x.expired?}.last.iksnr -> 72736 ch.oddb> registrations.values.find_all{ |x| x.expired?}[-3].iksnr -> 67769 ch.oddb> registrations.values.find_all{ |x| x.expired?}[-3].name_base -> Prick-Test ch.oddb> registrations.values.find_all{ |x| x.expired?}[-3].atc_classes.first.code -> V04CL
A trademark search for "Prick-Test" returns (117) elements on ch.oddb.org.
Running the smoketest discoverd a problem with the PI of Tramal, when we do not find a sequences. Fixed with commit Avoid nil error when heatmap does not find the corresponding sequence
I must still fix the following two problems
::1 - - [13/Sep/2017 16:20:57] "GET http://localhost:8612/favicon.ico HTTP/1.1" 200 1406 0.0008 "Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" RangeError: 0x003ff499ee25dc is not id value (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:373:in `_id2ref' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:373:in `to_obj' (druby://localhost:10000) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/drbwrapper.rb:70:in `to_obj' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1483:in `to_obj' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1787:in `to_obj' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:622:in `recv_request' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:931:in `recv_request' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1599:in `init_with_client' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1611:in `setup_message' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1563:in `perform' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1668:in `block (2 levels) in main_loop' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `loop' (druby://localhost:10000) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `block in main_loop' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/invokemethod.rb:11:in `block_yield' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/invokemethod.rb:18:in `block in perform_with_block' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/yus-1.0.4/lib/yus/server.rb:22:in `autosession' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/invokemethod.rb:15:in `perform_with_block' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1582:in `perform' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1668:in `block (2 levels) in main_loop' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `loop' (drbssl://localhost:9997) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `block in main_loop' /home/niklaus/git/oddb.org/src/util/oddbapp.rb:1894:in `yus_get_preference' /home/niklaus/git/oddb.org/src/util/oddbapp.rb:1908:in `yus_model' /home/niklaus/git/oddb.org/src/view/personal.rb:21:in `welcome'
This was easy to fix.
Adding a first watir test which checks, that the limitation for a SL-Category work.
Saved my search_prefs branch with the following new commits
Running the watir tests gives the following errors
rspec ./spec/address_correction_spec.rb:84 # ch.oddb.org should be possible to correct an address for a company rspec ./spec/admin_spec.rb[1:1] # ch.oddb.org should be possible to upload dummy_patinfo.pdf to a given package rspec ./spec/admin_spec.rb[1:2] # ch.oddb.org should be possible to upload dummy_patinfo_2.pdf to a given package rspec ./spec/admin_spec.rb:129 # ch.oddb.org should be possible to create a CompanyUser rspec ./spec/changelog_spec.rb[1:4] # ch.oddb.org change_log should have a working link to Patienteninformationinformation from the Patienteninformation diff rspec ./spec/download_spec.rb:27 # ch.oddb.org should download the results of a search to Marcoumar rspec ./spec/evidentia_spec.rb:56 # ch.oddb.org should list C09DB02 before C09DX03 when looking for Sevikar rspec ./spec/evidentia_spec.rb:67 # ch.oddb.org should list Keppra at the top when searching for Levetiracetam rspec ./spec/evidentia_spec.rb:73 # ch.oddb.org should list Levetiracetam Desitin at the top when searching for Levetiracetam Desitin rspec ./spec/evidentia_spec.rb:79 # ch.oddb.org should list all SL products before the Non-SL rspec ./spec/evidentia_spec.rb:100 # ch.oddb.org should not contain a column Fachinfo rspec ./spec/evidentia_spec.rb:113 # ch.oddb.org should contain a link to the limiation in Sevikar HCT preparation rspec ./spec/evidentia_spec.rb:124 # ch.oddb.org should contain a link to the price comparision in price public rspec ./spec/evidentia_spec.rb:134 # ch.oddb.org should contain a link to the FI for the drug when in price comparison rspec ./spec/evidentia_spec.rb:150 # ch.oddb.org should contain a link to the fachinfo for Lamivudin-Zidovudin rspec ./spec/evidentia_spec.rb:158 # ch.oddb.org should display a limitation link for Sevikar HCT rspec ./spec/evidentia_spec.rb:172 # ch.oddb.org should display lamivudin with SO and SG in category (price comparision) rspec ./spec/evidentia_spec.rb:179 # ch.oddb.org should list trademark first e.g. Duodopa rspec ./spec/evidentia_spec.rb:217 # ch.oddb.org should display Cellcept before other rspec ./spec/evidentia_spec.rb:225 # ch.oddb.org should list Levetiracetam Desitin with a link to the product overview rspec ./spec/paypal_spec.rb:86 # ch.oddb.org should be possible to checkout oddb.csv via paypal rspec ./spec/paypal_spec.rb:144 # ch.oddb.org should return a correct link to a CSV file if the payment is okay rspec ./spec/paypal_spec.rb:169 # ch.oddb.org should not download a CSV file if the payment was not accepted rspec ./spec/paypal_spec.rb:185 # ch.oddb.org should be possible to cancel a paypal before login rspec ./spec/paypal_spec.rb:198 # ch.oddb.org should be possible to cancel a paypal after login but before paying rspec ./spec/pharmacies_spec.rb:52 # ch.oddb.org check pharmacy rspec ./spec/rezept_and_instantsearch_spec.rb:452 # ch.oddb.org should not loose existing comment after adding a new prescription rspec ./spec/rezept_and_instantsearch_spec.rb:482 # ch.oddb.org should with four medicaments rspec ./spec/rezept_and_instantsearch_spec.rb:509 # ch.oddb.org should show the correct url after deleting a medicament rspec ./spec/rezept_and_instantsearch_spec.rb:571 # ch.oddb.org should be possible to print a presciption with 10 drugs rspec ./spec/rss_spec.rb[1:1] # ch.oddb.org should have a working RSS-feed hpc rspec ./spec/rss_spec.rb[1:2] # ch.oddb.org should have a working RSS-feed price_cut rspec ./spec/rss_spec.rb[1:3] # ch.oddb.org should have a working RSS-feed price_rise rspec ./spec/rss_spec.rb[1:4] # ch.oddb.org should have a working RSS-feed recall rspec ./spec/rss_spec.rb[1:5] # ch.oddb.org should have a working RSS-feed sl_introduction rspec ./spec/rss_spec.rb[1:6] # ch.oddb.org should have a working RSS-feed fachinfo rspec ./spec/rss_spec.rb:67 # ch.oddb.org should have a working fachinfo-2008 rspec ./spec/searchbar_spec.rb[1:2] # ch.oddb.org should be possible to find 1,25-Dihydroxycholecalciferol when searching via 125 in analysen rspec ./spec/searchbar_spec.rb:153 # ch.oddb.org should work with the privatetemplate searchbar rspec ./spec/searchbar_spec.rb:339 # ch.oddb.org should show no drugs for Fortex via unwanted effects search rspec ./spec/searchbar_spec.rb:391 # ch.oddb.org should set best_result when searching Rivoleve via search_type rspec ./spec/smoketest_spec.rb:220 # ch.oddb.org should find redirect an iphone to the mobile flavor rspec ./spec/smoketest_spec.rb:345 # ch.oddb.org should download the example