<commit_before>require 'json'
require 'sparql/client'
require 'rdf/turtle'
require 'umakadata/data_format'
require 'umakadata/linkset'

class EndpointsController < ApplicationController

  include Umakadata::DataFormat
  include Umakadata::Linkset

  before_action :set_endpoint, only: [:show]

  def top
    conditions = {'evaluations.latest': true}
    @endpoints = Endpoint.includes(:evaluation).where(conditions).order('evaluations.score DESC')
  end

  def search
  end

  def show
  end

  def log
    evaluation = Evaluation.where(:id => params[:evaluation_id]).first
    @endpoint_id = evaluation.endpoint_id
    json = nil
    case(params[:name])
    when 'alive' then
      json = evaluation.alive_error_reason
    when 'execution_time' then
      json = evaluation.execution_time_error_reason
    else
      json = nil
    end

    begin
      log = JSON.parse(json)
      @log = log
    rescue<commit_msg>remove unnecessary valiable<commit_after>require 'json'
require 'sparql/client'
require 'rdf/turtle'
require 'umakadata/data_format'
require 'umakadata/linkset'

class EndpointsController < ApplicationController

  include Umakadata::DataFormat
  include Umakadata::Linkset

  before_action :set_endpoint, only: [:show]

  def top
    conditions = {'evaluations.latest': true}
    @endpoints = Endpoint.includes(:evaluation).where(conditions).order('evaluations.score DESC')
  end

  def search
  end

  def show
  end

  def log
    evaluation = Evaluation.where(:id => params[:evaluation_id]).first
    @endpoint_id = evaluation.endpoint_id
    json = nil
    case(params[:name])
    when 'alive' then
      json = evaluation.alive_error_reason
    when 'execution_time' then
      json = evaluation.execution_time_error_reason
    else
      json = nil
    end

    begin
      @log = JSON.parse(json)
    rescue
{'fraction_non_alphanumeric': 0.09224890829694324, 'fraction_numerical': 0.0, 'mean_word_length': 3.7, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4219293', 'n_tokens_mistral': 573, 'n_tokens_neox': 554, 'n_words': 131}