Sha256: a9da5a8672a303dd1e8097d2e93c939649f03e8b7856f7b0d5fe9367a391dad2

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

class Dbsetup
  def initialize(connect_time)
    @connect_time = connect_time
    @ct = <%= module_name %>::<%= classname %>.create( <%= classname_downcase %>: @connect_time )
    @hs_by_notebook = {}
    @hs_by_id = {}
  end
=begin
  # 指定stack(文字列)にノートブック(文字列)、ノートブック数、タグ数を追加
  def add( stack , notebook, count, tag_count )
    ennblist = @hs_by_notebook[notebook]
    unless ennblist
      cur_ennblist = Currentennblist.where( notebook: notebook ).limit(1)
      if cur_ennblist.size == 0
        begin
          ennblist = Ennblist.create( stack: stack, notebook: notebook , count: count, tag_count: tag_count , start_datetime: @register_time )
          evnb = Evnb.create( time_id: @ct.id , ennb_id: ennblist.id )
        rescue => ex
          p ex.class
          p ex.message
          pp ex.backtrace

          ennblist = nil
          evnb = nil
        end
      else
        current_ennblist = cur_ennblist.first.ennblist
        hs = {:stack => stack, :count => count , :tag_count => tag_count }
        value_hs = hs.reduce({}){ |hsx,item|
          if current_ennblist[ item[0] ] != item[1]
            hsx[ item[0] ] = item[1]
          end
          hsx
        }
        if value_hs.size > 0
          if value_hs.all? { |item| item[1] != nil }
            current_ennblist.update(value_hs)
          end
        end
      end
    else
      # ignore this case.
    end
    if ennblist
      @hs_by_notebook[notebook] = ennblist
      @hs_by_id[ennblist.id] = ennblist
    end
    ennblist
  end
=end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arxutils_sqlite3-0.1.44 lib/template/relation/db_scheme/dbsetup.rb
arxutils_sqlite3-0.1.43 lib/template/relation/db_scheme/dbsetup.rb
arxutils_sqlite3-0.1.40 lib/template/relation/db_scheme/dbsetup.rb
arxutils_sqlite3-0.1.39 lib/template/relation/db_scheme/dbsetup.rb
arxutils_sqlite3-0.1.38 lib/template/relation/db_scheme/dbsetup.rb
arxutils_sqlite3-0.1.37 lib/template/relation/db_scheme/dbsetup.rb