view · edit · sidebar · attach · print · history

20160802-migrate-davaz-com

<< 20160803-migrate-davaz-com | Index | 20160801-migrate-davaz-com-dojo-widgets >>


Summary

  • Migrate davaz.com (javasrcipt, ruby)
  • Refactor States (admin, ajax)

Commits / Patches / Pull Requests, Scripts

Index


Refactor admin and ajax states

I was able to migrate javascript and dojo widgets, mostly.
From yesterday, I'm upgrading and refactoring Ruby code.

It works, but there still many small problems in Ruby 2.3.1.
So, I will continue refactoring to reduce these problem, before to fix its.

Replace (creati partial directory)

# Move all partial state/view files to _partial directory like below
% grep -r 'view/navigation' src                                                                  
src/view/gallery/result.rb:require 'view/navigation'
src/view/template.rb:require 'view/navigation'

# Replace require with sed
% find src/view -iname '*.rb' -print | xargs sed -i 's/view\/navigation/view\/_partial\/navigation/g'
  • DAVAZ to DaVaz
  • Refactor db_manager (Reduce unnecessary variables and if/else block)
  • Refactor states (Reduce unnecessary if/else block)
  • Fix indent and Remove remain tabs and white spaces at end of line
  • Remove duplicated classes and files (same names)
  • Refactor SQL query (I would like to MySQL log with `general_log = 1`)

Commit: Refactor state/view/util files

Tomorrow, write test, and then restart to migrate ruby and javascript for admin features.

This is MySQL log (general.log)

# in my.cnf
general_log_file = /var/log/mysql/query.log
general_log      = 1
# query.log
12 Connect   davaz@localhost on davaz
12 Query     SELECT artobject_id, artgroup_id, url FROM artobjects WHERE artgroup_id = 'MOV' ORDER BY title DESC
12 Query     SELECT * FROM oneliner WHERE location='index'
12 Query     SELECT artobjects.*, artgroups.name AS artgroup, materials.name AS material, series.name AS serie, tools.name AS tool, countries.name AS country FROM artobjects LEFT OUTER JOIN artgroups ON artobjects.artgroup_id = artgroups.artgroup_id LEFT OUTER JOIN materials ON artobjects.material_id = materials.material_id LEFT OUTER JOIN series ON artobjects.serie_id = series.serie_id LEFT OUTER JOIN tools ON artobjects.tool_id = tools.tool_id LEFT OUTER JOIN countries ON artobjects.country_id = countries.country_id WHERE artobjects.artgroup_id='MUL' ORDER BY artobjects.serie_position,artobjects.date ASC,artobjects.title
12 Query     SELECT links.artobject_id AS reference, links.*, artobjects.* FROM links JOIN links_artobjects USING (link_id) JOIN artobjects ON links_artobjects.artobject_id = artobjects.artobject_id WHERE links.artobject_id IN ('208','217','218','219',...) ORDER BY links.artobject_id, links.word
12 Query     SELECT artobjects.artobject_id AS reference, tags.* FROM artobjects LEFT OUTER JOIN tags_artobjects USING (artobject_id) LEFT OUTER JOIN tags ON tags.tag_id = tags_artobjects.tag_id WHERE artobjects.artobject_id IN ('208','217','218','219','220','221','222','223','225','226','227','209','228','229','230', ...) ORDER BY tags.name
12 Query     SELECT artobjects.*, artgroups.name AS artgroup, materials.name AS material, series.name AS serie, tools.name AS tool, countries.name AS country FROM artobjects LEFT OUTER JOIN artgroups ON artobjects.artgroup_id = artgroups.artgroup_id LEFT OUTER JOIN materials ON artobjects.material_id = materials.material_id LEFT OUTER JOIN series ON artobjects.serie_id = series.serie_id LEFT OUTER JOIN tools ON artobjects.tool_id = tools.tool_id LEFT OUTER JOIN countries ON artobjects.country_id = countries.country_id WHERE artobjects.artgroup_id='MUL' ORDER BY artobjects.serie_position,artobjects.date ASC,artobjects.title
12 Query     SELECT links.artobject_id AS reference, links.*, artobjects.* FROM links JOIN links_artobjects USING (link_id) JOIN artobjects ON links_artobjects.artobject_id = artobjects.artobject_id WHERE links.artobject_id IN ('208','217','218','219','220','221','222','223','225','226','227','209','228','229','230', ...) ORDER BY links.artobject_id, links.word
12 Query     SELECT artobjects.artobject_id AS reference, tags.* FROM artobjects LEFT OUTER JOIN tags_artobjects USING (artobject_id) LEFT OUTER JOIN tags ON tags.tag_id = tags_artobjects.tag_id WHERE artobjects.artobject_id IN ('208','217','218','219','220','221','222','223','225','226','227','209','228','229','230','231', ...) ORDER BY tags.name
...
view · edit · sidebar · attach · print · history
Page last modified on August 02, 2016, at 07:40 PM