<commit_before>class Api::V1::QuizzesController < ApplicationController
    protect_from_forgery with: :null_session

    def show
        quizzes = Quiz.all
        render json: {result: quizzes}
    end

    def create
        @quiz = Quiz.new(quiz_params)
        if @quiz.save
            render json: {result: true}
        else
            render json: {result: false}
        end
    end

    def update
        @quiz = Quiz.find(params[:id])
        if @quiz.update(quiz_params)
            render json: {result: true}
        else
            render json: {result: false}
        end
    end

    def destroy
        @quiz = Quiz.find(params[:id])
        if @quiz.destroy
            render json: {result: true}
        else
            render json: {result: false}
        end
    end

    def challenges
        quizzes = Quiz.find(Quiz.pluck(:id).shuffle[0..9])
        render json: {result: quizzes}
    end<commit_msg>追加APIの戻り値を修正<commit_after>class Api::V1::QuizzesController < ApplicationController
    protect_from_forgery with: :null_session

    def show
        quizzes = Quiz.all
        render json: {result: quizzes}
    end

    def create
        @quiz = Quiz.new(quiz_params)
        if @quiz.save
            render json: {id: @quiz[:id]}
        else
            render json: {result: false}, status: 500
        end
    end

    def update
        @quiz = Quiz.find(params[:id])
        if @quiz.update(quiz_params)
            render json: {result: true}
        else
            render json: {result: false}, status: 500
        end
    end

    def destroy
        @quiz = Quiz.find(params[:id])
        if @quiz.destroy
            render json: {result: true}
        else
            render json: {result: false}, status: 500
        end
    end

    def challenges
        quizzes = Quiz.find(Quiz.pluck(:id).shuffle[0..9])
        render json: {result: quizzes}
    end
{'fraction_non_alphanumeric': 0.09548793284365163, 'fraction_numerical': 0.007869884575026232, 'mean_word_length': 1.7677793904208998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5385635', 'n_tokens_mistral': 612, 'n_tokens_neox': 596, 'n_words': 155}