view · edit · sidebar · attach · print · history

20110630-export-gag-customer-data-testcases-oddb_org-view-11-state-4-model-1-command-1

<< | Index | >>


  1. Check source code bbmb.ch
  2. Testcases oddb.org

Goal/Estimate/Evaluation
  • Export customer data / 100% / 100%
  • Testcases / 93% / 92.62%
Milestones
Summary
Commits

Check source code bbmb.ch

Experiment (src/util/oddbapp.rb)

  def output_active_users(file_path=nil)
    dir = File.expand_path('../../data', File.dirname(__FILE__))
    file_path ||= File.join(dir, 'active_users_' + Time.now.strftime('%Y%m%d') + '.csv')
    open(file_path,'w') do |out|
      out.print "EAN-Code,GAG-Code,Name,Address,Last Login Time\n"
      users.values.each do |user|
        if user.name == 'hospital' and user.value(:active) == 'y'
          out.print user.value(:customer_ean13), ",", user.value(:customer_id), ",", user.value(:firstname), " ", user.value(:lastname), ",", user.value(:address1), " ", user.value(:address2), " ", user.value(:address3), ",", user.value(:last_login), "\n"
        end
      end
    end
    file_path
  end

Run

  • bin/bbmbd
  • bin/admin
masa@masa ~/ywesee/bbmb.ch $ bin/admin
ch.bbmb.globopharm> output_active_users
-> /home/masa/ywesee/bbmb.ch/data/active_users_20110630.csv

Result

masa@masa ~/ywesee/bbmb.ch $ cat data/active_users_20110630.csv 
EAN-Code,GAG-Code,Name,Address,Last Login Time
7601001056657,584674,firstname lastname,add1 hoge hoge 11 ,Thu Jun 30 07:50:08 +0200 2011

Restart bbmbd online server

  • It takes about 5 minutes to reboot bbmbd

Commit

IMPORTANT

  • Never use ',' (comma) for csv file, use ';' (semicolon)
  • Sometimes, name and address data includes ',' (comma)

Testcases oddb.org

  1. src/view/admin/indication.rb (coverage: 100%)
  2. src/view/exception.rb (coverage: 100%)
  3. src/view/hospitals/centeredsearchform.rb (coverage: 100%)
  4. src/view/substances/centeredsearchform.rb (coverage: 100%)
  5. src/view/user/passthru.rb (coverage: 100%)
  6. src/view/admin/patinfopreview.rb (coverage: 100%)
  7. src/view/user/auth_info.rb (coverage: 100%)
  8. src/view/substances/centeredsearchform.rb (coverage: 100%)
  9. src/view/user/sponsorlink.rb (coverage: 100%)
  10. src/view/confirm.rb (coverage: 100%)
  11. src/view/resulttemplate.rb (coverage: 100%)
  12. src/state/drugs/fachinfos.rb (coverage: 100%)
  13. src/state/user/contributor.rb (coverage: 100%)
  14. src/state/admin/global.rb (coverage: 100%)
  15. src/state/user/download.rb (coverage: 100%)
  16. src/command/accept_orphan.rb (coverage: 100%)
  17. src/model/sequence_observer.rb (coverage: 100%)
  18. src/state/drugs/ddd.rb (coverage: 39.39%)
  19. src/state/ajax/ddd_chart.rb (coverage: 37.50%)
  20. src/state/drugs/init.rb (coverage: 75.00%)
  21. src/state/drugs/payment_method.rb (coverage: 46.88%)
  22. src/state/substances/result.rb (coverage: 46.88%)
  23. src/remote/sequence.rb (coverage: 42.42%)

Commit

view · edit · sidebar · attach · print · history
Page last modified on June 30, 2011, at 04:49 PM