view · edit · sidebar · attach · print · history

20110905-update-degi-flavor-oddb_org-502-entry-xmlconv-debug-importer-testcases-migel

<< Masa.20110906-update-importer-testcases-migel | 2011 | Masa.20110902-refactoring-testcases-search-migel >>


  1. Change the top view of desi.oddb
  2. Testcases for the update of desi view
  3. Fix xmlconv 502 entry
  4. Debug Importer crash
  5. Testcases (Behaviour) migel

Goal/Estimate/Evaluation:

  • Debug importer migel / 80% / 20%
Milestones
  1. desi.oddb flavor top view
  2. testcases degi top view
  3. xmlconv 502 entry
  4. debug importer migel suspend
  5. testcases migel
Summary
Commits
ToDo
  • 'desi' testcases
  • refactor rebuild_fulltext_index_tables
  • delete_migelids in lib/migel/util/server.rb
  • 'could not sort' warning -> this is caused by probably to_s method
  • RangeError 0x3fd07d5c4ee0 is recycled object
  • Testcases oddb.org, migel
    • at the same time, refactoring Group, Subgroup, Migelid because some code in the classes are totally same
  • Importer takes longer

Change the top view of ch.oddb

Task

  • Change the top view of desi.oddb.org
  • Change home link when the logo is clicked

Experiment

  • src/view/logo.rb
module ODDB
  module View
    class PopupLogo < HtmlGrid::Component
...
      def to_html(context)
        link_attrs = {
          #"href" => @lookandfeel._event_url(:home)
          "href"  => 'http://www.google.com'
        }

Result

  • The logo link has changed

Note

Consideration

  • The _event_url method in SBSM should not be updated

Experiment

  • src/view/logo.rb
      def to_html(context)
        link_attrs = if attrs = @lookandfeel.attributes(:logo) and href = attrs['href']
                       { "href" => href }
                     else
                       { "href" => @lookandfeel._event_url(:home) }
                     end
        context.a(link_attrs) {
          context.img(@attributes)
        }
      end
  • src/custom/lookandfeelwrapper.rb class LookandfeelDesitin < SBSM::LookandfeelWrapper ...
    HTML_ATTRIBUTES = {
      :logo => {
        'width'  => '168',
        'height' => '95',
        'href'   => 'http://www.desi.ch',
      },
    }

Access

Result

  • The logo link URL has changed

Next

Refer

  • src/custom/lookandfeelwrapper.rb
  class LookandfeelDesitin < SBSM::LookandfeelWrapper
    RESULT_FILTER = Proc.new do |seq| (comp = seq.company) && comp.oid == 215 end

Note

Refer

  • src/state/global.rb#search
  • src/state/global.rb#_search_drugs_state

Note

Experiment

  • src/state/global.rb#_search_drugs_state
      def _search_drugs_state(query, stype)
      ...
          @session.set_cookie_input(:resultview, 'pages') if @session.flavor == 'desitin'
          state = State::Drugs::Result.new(@session, result)
          state.search_query = query
          state.search_type = stype
          state
        end
      end

Access

  1. http://oddb.masa.org/de/desitin/search/zone/drugs/search_query/desitin/search_type/st_company
  2. http://oddb.masa.org/de/gcc/search/zone/drugs/search_query/desitin/search_type/st_company/

Result

  • The 1st shows an expanded view
  • The 2nd shows a compact view

Commit

Pull error

/var/www/oddb.org $ git pull
Updating 9f9fa46..f9af421
error: Your local changes to the following files would be overwritten by merge:
        src/custom/lookandfeelwrapper.rb
Please, commit your changes or stash them before you can merge.
Aborting

git diff

diff --git a/src/custom/lookandfeelwrapper.rb b/src/custom/lookandfeelwrapper.rb
index 9ac7fb1..77b9644 100644
--- a/src/custom/lookandfeelwrapper.rb
+++ b/src/custom/lookandfeelwrapper.rb
@@ -786,6 +786,7 @@ module ODDB
       :explain_sort,
       :compare_backbutton,
       :custom_tab_navigation,
+      :ddd_chart,
                        :external_css,
       :ajax,
                        :home_drugs,
@@ -793,6 +794,7 @@ module ODDB
                        :faq_link,
       :patinfos,
                        :sequences,
+                       :price_history,
                        :ywesee_contact,
                ]
                DISABLED = [ :atc_ddd, :legal_note, :navigation, :price_request ]
@@ -835,6 +837,14 @@ module ODDB
                                [8,0]   =>      :deductible, 
                        }       
                end
+               PH_END = Date.new(2010,4,10)
+               def enabled?(event, default=false)
+                 if event == :price_history && @@today < PH_END
+                   true
+                 else
+                   super
+                 end
+               end
                def explain_result_components
                        {
                                [0,1]   =>      :explain_original,

Note

  • The src/custom/lookandfeelwrapper.rb has been changed directly on the server

Commit

Testcases for the update of desi view

  1. src/view/logo.rb
  2. src/state/global.rb
  3. src/custom/lookandfeelwrapper.rb

Commit

Fix xmlconv 502 entry

Email

Experiment

  • lib/xmlconv/i2/position.rb
      def to_s
        output = <<-EOS
500:#{@number}
        EOS
#501:#{@article_ean}
        [@customer_id, @pharmacode].compact.each { |id|
          #output << sprintf("502:%s\n", id)
          output << sprintf("501:%s\n", id)
        }

Run

  • bin/bbmbd
  • bin/xmlconvd

Setup

  • copy imput.xml in xml_order directory
masa@masa ~/ywesee/globopharm.xmlconv.bbmb.ch $ cp input.xml xml_orders/

Access

Result

...
300:4
301:20110905
500:1
501:7680542300870
501:1954753
520:2
521:PCE
500:2
501:7680542300528
501:1954724
520:1
521:PCE
500:3
501:7680486270215
501:1342257
520:1
521:PCE
...

Debug Importer crash

Problem

  • migel importer stops with Segmentation fault sometimes during the importing of products (update_products method)
...
20 / 187        Estimate total: 54.78 [m] It will be done in: 48.92 [m]
21 / 187        Estimate total: 52.65 [m] It will be done in: 46.74 [m]
22 / 187        Estimate total: 51.55 [m] It will be done in: 45.48 [m]
/usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:324: [BUG] Segmentation fault
...
7 / 571 Estimate total: 6.12 [h] It will be done in: 6.04 [h]
8 / 571 Estimate total: 5.42 [h] It will be done in: 5.34 [h]
/usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:179: [BUG] Segmentation fault
  • /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:324: [BUG] Segmentation fault
324    def fetch_or_do(obj_id, odba_caller, &block) # :nodoc:
325      if (cache_entry = fetch_cache_entry(obj_id)) && cache_entry._odba_object
326       cache_entry.odba_add_reference(odba_caller)
327        cache_entry.odba_object
328      else
329        block.call
330      end
331    end
  • /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb
class Array
..
178  def -(stub)
179    self._odba_minus(stub.odba_instance)
180  end

Note

  • This is a defficult to be debugged
  • Because this segmentation fault happens SOMETIMES
  • I cannot reproduce the same error again

Reference

suspend

Testcases (Behaviour) migel

Refer to

migel server side

  1. model
    1. group.rb
    2. subgroup.rb
    3. migelid.rb
    4. product.rb

Question

  • How to check code coverage with rspec
view · edit · sidebar · attach · print · history
Page last modified on March 12, 2013, at 02:08 PM