<commit_before>module API
  module V1
    class Comments < Grape::API
      before { authenticate! }

      resource :articles do
        # Collect comments from articles
        #
        # Parameters:
        #   reference_id     - comment id used as reference to collect comment
        #   oldest           - Collect the oldest comments from reference_id comment. If nothing is passed the newest comments are collected
        #   limit            - amount of comments returned. The default value is 20
        #
        # Example Request:
        #  GET /articles/12/comments?oldest&limit=10&reference_id=23
        get ":id/comments" do

          conditions = make_conditions_with_parameter(params)

          if params[:reference_id]
            comments = environment.articles.find(params[:id]).comments.send("#{params.key?(:oldest) ? 'older_than' : 'newer_than'}", params[:reference_id]).find(:all, :conditions => conditions, :limit => limit, :order => "created_at DESC")
          else
            comments = environment.articles.find(params[:id]).comments.find(:all, :conditions => conditions, :limit => limit, :order => "created_at DESC")
          end
          present comments, :with => Entities::Comment

        end

        get ":id/comments/:comment_id" do
          present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment
        end

        # Example Request:
        #  POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment
        post ":id/comments" do
          present environment.articles.find(params[:id]).comments.create(:author => current_person, :body => params[:body]), :with => Entities::Comment
        end
      end

    end
  end
end<commit_msg>Api fix to get the reverse order of the comments<commit_after>module API
  module V1
    class Comments < Grape::API
      before { authenticate! }

      resource :articles do
        # Collect comments from articles
        #
        # Parameters:
        #   reference_id     - comment id used as reference to collect comment
        #   oldest           - Collect the oldest comments from reference_id comment. If nothing is passed the newest comments are collected
        #   limit            - amount of comments returned. The default value is 20
        #
        # Example Request:
        #  GET /articles/12/comments?oldest&limit=10&reference_id=23
        get ":id/comments" do

          conditions = make_conditions_with_parameter(params)

          if params[:reference_id]
            comments = environment.articles.find(params[:id]).comments.send("#{params.key?(:oldest) ? 'older_than' : 'newer_than'}", params[:reference_id]).reorder("created_at DESC").find(:all, :conditions => conditions, :limit => limit)
          else
            comments = environment.articles.find(params[:id]).comments.reorder("created_at DESC").find(:all, :conditions => conditions, :limit => limit)
          end
          present comments, :with => Entities::Comment

        end

        get ":id/comments/:comment_id" do
          present environment.articles.find(params[:id]).comments.find(params[:comment_id]), :with => Entities::Comment
        end

        # Example Request:
        #  POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment
        post ":id/comments" do
          present environment.articles.find(params[:id]).comments.create(:author => current_person, :body => params[:body]), :with => Entities::Comment
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.10914205344585091, 'fraction_numerical': 0.015189873417721518, 'mean_word_length': 2.6359918200409, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 23, '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': '623187', 'n_tokens_mistral': 980, 'n_tokens_neox': 919, 'n_words': 244}