view · edit · sidebar · attach · print · history

< Niklaus.20180207-lighthouse | Index | Niklaus.20180205-drugshortage-error >>

20180206-pi-error

Summary

  • Fix NoMethod error for certain PI
  • Adapt oddb2xml to new XLSX header of swissmedic
  • Do not show adsense when logged in
  • Fix/improve dojo loading
  • Keep in Mind

Commits

Index

Done with commit Adapt to swissmedic fixing a typo in Packungen.XLSX header row. Release a new version 2.5.0 of oddb2xml gem.

Adapt oddb2xml to new XLSX header of swissmedic

Looking at the changes made yesterday I remarked that I must also adapt oddb2xml to handle the new header row of Swissmedic packages.

Fix NoMethod error for certain PI

Fix error when visiting https://ch.oddb.org/de/gcc/patinfo/reg/66331/seq/01/pack/001 throw errors

Must reparse the following registrations 00627 00657 00685 00702 31514 31723 33801 38605 39253 43307 44448 44915 46996 47000 47909 48280 48669 49137 49188 50581 52535 52815 53161 54058 54378 54604 55065 55269 55584 55902 56072 56257 56349 56906 56922 57178 57526 57664 57870 58868 60808 61251 61252 61621 65100 65311 65497 65892 65916 66003 66068 66071 66105 66130 66172 66216 66331 66345 66363 66377 66415 66428 66468 66483 66490 66513 66590 66659 66719 66837

It took me some time to find the correct expression to catch wrong entries in our database.

Trying to remedy the problem in the database by executing in bin/admin.

ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.size
-> 131
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.each{|x| x.patinfo = nil; x.odba_store}
-> Array
active_packages.find_all{|x| x.patinfo && x.patinfo.de && x.patinfo.de.is_a?(String)}.each{|x| x.patinfo.descriptions['de'] = nil; x.odba_store}
-> Array
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.size
-> 0

This correction did not work correctly and the patinfo were present again after restarting ch.oddb. Why? Must we delete the patinfos variable of app, too?

Tried a separate odbastore on the patinfo and this seems to work

ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de && x.patinfo.de.is_a?(String)}.each{|x| x.patinfo.descriptions['de'] = nil; x.patinfo.odba_store; x.odba_store}
-> Array
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.size
-> 0
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.size
-> druby://localhost:10000 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 10000>
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.size
-> 0

Saving on thinpower the registrations numbers to be reparse with the following bin/admin. Then deleting all wrong patinfos.

File.open('/var/www/oddb.org/log/to_reparse.lst', 'w+') {|f| f.puts active_packages.find_all{|x| x.patinfo && x.patinfo.de.is_a?(String)}.collect{ |x| x.iksnr}.sort.uniq.join(" ")}
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de && x.patinfo.de.is_a?(String)}.each{|x| x.patinfo.descriptions['de'] = nil; x.patinfo.odba_store; x.odba_store}
-> Array
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de && x.patinfo.de.is_a?(String)}.size
-> 0
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.fr && x.patinfo.fr.is_a?(String)}.size
-> 0

Pushed commits:

Now reparsing the concerned PIs on thinpower.

Do not show adsense when logged in

Reimported yus database from thinpower.

When logged there is an adsense present in the homes like doctors. This should not be the case. This should be fixed with the commit Do not show adsense when logged in

Now I must see whether I can fix the size of the displayed ad, which is way too big on the home pages. This should be fixed with commit Fix displaying adds on home pages

#dojo Fix/improve dojo loading

We used the chrome extension lighthouse to check against ch.oddb.org. Lighthouse suggest to use gzip compression. We used the compressed version of dojo, but not in the gzip format. Installing on oddb-ci2 the newest version of dojo. Currently we have dojo.version {major: 1, minor: 12, patch: 1, flag: "", revision: "a1e2d9d"). Installing dojo 1.13.0 and ran lighthouse against it. No significant difference seen.

Also I would like to get rid of the dojo error:

dojo.js:8 Uncaught TypeError: Cannot read property 'has' of undefined
    at _6b (dojo.js:8)
    at _16 (dojo.js:8)
    at req (dojo.js:8)

Replace dojo.js by dojo.js.uncompressed. Looks like we did not define a userConfig.

Modified htmlgrid/dojotoolkit.rb to add first the following snippet to the HTML headers

        headers << %(<script>
       var dojoConfig = {
            parseOnLoad: true,
            isDebug: true,
            locale: 'de-ch',
            async: true,
        };
</script>)

Now I get different errors

Navigated to https://oddb-ci2.dyndns.org/
dojo.js:1930 Error: defineAlreadyDefined
    at makeError (VM3159 dojo.js:138)
    at async (VM3159 dojo.js:1979)
    at VM3159 dojo.js:2009
(anonymous) @ dojo.js:1930
(anonymous) @ dojo.js:401
forEach @ dojo.js:125
req.signal @ dojo.js:400
async @ dojo.js:1979
(anonymous) @ dojo.js:2009
dojo.js:1933 src: dojoLoader
dojo.js:1933 info: 0
dojo.js:1935 .
VM3159 dojo.js:645 Uncaught TypeError: Cannot read property 'has' of undefined
    at config (VM3159 dojo.js:645)
    at contextRequire (VM3159 dojo.js:832)
    at req (VM3159 dojo.js:156)
config @ VM3159 dojo.js:645
contextRequire @ VM3159 dojo.js:832
req @ VM3159 dojo.js:156
setTimeout (async)
(anonymous) @ (index):12
callback @ dojo.js:10338
onEvent @ dojo.js:10264
(anonymous) @ VM3159 dojo.js:401
forEach @ VM3159 dojo.js:125
req.signal @ VM3159 dojo.js:400
guardCheckComplete @ VM3159 dojo.js:1328
checkComplete @ VM3159 dojo.js:1338
onLoadCallback @ VM3159 dojo.js:1505
onLoad @ VM3159 dojo.js:175
8

Aded console.log and found out that this error comes only after loading Urchin.

After changing the dynamic_html procedure in publictemplate to return

require(['dojo/ready','dojox.analytics.Urchin'], function(ready) {
  ready(function() {
      dojo.ready(function(){
        new dojox.analytics.Urchin({ acct:"#{@lookandfeel.google_analytics_token}" });
    });
  });
});

I got the errors

Uncaught SyntaxError: Unexpected token <
dojo.js:1931 TypeError: Cannot read property 'Urchin' of undefined
    at (index):14
    at callback (dojo.js:10339)
    at onEvent (dojo.js:10265)
    at dojo.js:402
    at forEach (dojo.js:125)
    at req.signal (dojo.js:401)
    at guardCheckComplete (dojo.js:1329)
    at checkComplete (dojo.js:1339)
    at onLoadCallback (dojo.js:1506)
    at HTMLScriptElement.onLoad (dojo.js:1759)
(anonymous) @ dojo.js:1931
(anonymous) @ dojo.js:402
forEach @ dojo.js:125
req.signal @ dojo.js:401
onEvent @ dojo.js:10270
(anonymous) @ dojo.js:402
forEach @ dojo.js:125
req.signal @ dojo.js:401
guardCheckComplete @ dojo.js:1329
checkComplete @ dojo.js:1339
onLoadCallback @ dojo.js:1506
onLoad @ dojo.js:1759
dojo.js:1934 info: Cannot read property 'Urchin' of undefined
dojo.js:1936 .

Fixed it using a different path to Urchin. Now the dojo error has gone. Lighthouse sees some performance increase to 69 and best practices to 88.

It was possible to copy the compressed dojo.js.gz to dojo.js and still load the page correctly.

Pushed commit Fix dojo error on loading page

view · edit · sidebar · attach · print · history
Page last modified on February 06, 2018, at 05:19 PM