You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tracker.rb
    path of file: ./repos/linuxfr.org/app/models/statistics
    
    the code of the file until where you have to start completion: # encoding: utf-8
class Statistics::Tracker < Statistics::Statistics

    
  def by_month
    return @by_month if @by_month

    @by_month = {}
    entries = select_all("SELECT state, SUBSTRING(CONVERT_TZ(trackers.created_at, 'UTC', 'Europe/Paris')+0,1,6) AS created, SUBSTRING(trackers.updated_at+0,1,6) AS updated FROM trackers, nodes WHERE nodes.content_id=trackers.id AND nodes.content_type='Tracker' AND public=1")
    entries.each do |entry|
      @by_month[entry["created"]] ||= {}
      @by_month[entry["created"]]["opened"] ||= 0
      @by_month[entry["created"]]["opened"]  += 1

      if entry["state"] != "opened"
        @by_month[entry["updated"]] ||= {}
        @by_month[entry["updated"]][entry["state"]] ||= 0
        @by_month[entry["updated"]][entry["state"]]  += 1
      end
    end