<commit_before>class API::V1::FormsController < API::V1::BaseController
  respond_to :json

  def index
    if params[:mission_name].present?
      @mission = Mission.where(:compact_name => params[:mission_name]).first
      forms = @mission.forms.where(access_level: AccessLevel::PUBLIC)
      render :json => forms.to_json(:only => [:id, :name, :responses_count, :created_at, :updated_at])
    end
  end

  def show
    @form = Form.includes(:questions).where(id: params[:id]).first
    render :json => @form.to_json(only: [:id, :name, :created_at, :updated_at],
                                  include: { questions: { only: [:id, :_name] } } )
  end
end





<commit_msg>only get public questions for now<commit_after>class API::V1::FormsController < API::V1::BaseController
  respond_to :json

  def index
    if params[:mission_name].present?
      @mission = Mission.where(:compact_name => params[:mission_name]).first
      forms = @mission.forms.where(access_level: AccessLevel::PUBLIC)
      render :json => forms.to_json(:only => [:id, :name, :responses_count, :created_at, :updated_at])
    end
  end

  def show
    @form = Form.includes(:questions).where(id: params[:id]).where(:questionables => { access_level: AccessLevel::PUBLIC }).first
    render :json => @form.to_json(only: [:id, :name, :created_at, :updated_at],
                                  include: { questions: { only: [:id, :_name] } } )
  end
end






{'fraction_non_alphanumeric': 0.15121951219512195, 'fraction_numerical': 0.0027874564459930314, 'mean_word_length': 3.5443037974683542, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3421780', 'n_tokens_mistral': 473, 'n_tokens_neox': 451, 'n_words': 96}