<commit_before>require 'date'
require 'json'
require 'sinatra'
require 'erb'
require 'dm-core'
require 'dm-migrations'

DataMapper::setup(:default, ENV['DATABASE_URL'] || 'sqlite3:db.sqlite3')

class KitakuTime
  include DataMapper::Resource
  property :id, Serial
  property :minute, Integer
  property :target_date, Date
  auto_upgrade!
end

get '/' do
  erb :index
end

get '/index.json' do
  content_type :json
  kitakutime = KitakuTime.all(:order => [:target_date.desc])
                         .map{ |data| [data.target_date, data.minute] }
  JSON.unparse(kitakutime)
end
<commit_msg>add update function using POST<commit_after>require 'date'
require 'json'
require 'sinatra'
require 'erb'
require 'dm-core'
require 'dm-migrations'

DataMapper::setup(:default, ENV['DATABASE_URL'] || 'sqlite3:db.sqlite3')

class KitakuTime
  include DataMapper::Resource
  property :id, Serial
  property :minute, Integer
  property :target_date, Date
  auto_upgrade!
end

get '/' do
  erb :index
end

post '/' do
  kitakutime = KitakuTime.create(:minute => params[:minute],
                                 :target_date => params[:target_date])
end

get '/index.json' do
  content_type :json
  kitakutime = KitakuTime.all(:order => [:target_date.desc])
                         .map{ |data| [data.target_date, data.minute] }
  JSON.unparse(kitakutime)
end

{'fraction_non_alphanumeric': 0.1261127596439169, 'fraction_numerical': 0.002967359050445104, 'mean_word_length': 3.800711743772242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3027867', 'n_tokens_mistral': 463, 'n_tokens_neox': 459, 'n_words': 110}