def to_json(pretty=true)
      db.results_as_hash = false
      totals = db.execute("select * from totals")
      hash_total = []
      totals.each do |row|
        h = {}
        (0...row.length).each do |col|
          h[total_columns[col]] = row[col]
        end
        hash_total << h
      end
      if pretty
        JSON.pretty_generate(hash_total)
      else
        hash_total.to_json
      end
    end
def to_json(pretty=true)
      db.results_as_hash = false
      totals = db.execute("select * from totals")
      hash_total = []
      totals.each do |row|
        h = {}
        (0...row.length).each do |col|
          h[total_columns[col]] = row[col]
        end
        hash_total << h
      end
      if pretty
        JSON.pretty_generate(hash_total)
      else
        hash_total.to_json
      end
    end
returns the totals view as json
 the results as hash returns extra key/values we don't want so
 we had to create our own hash
 there are better ways of doing this but this was simple to create