<commit_before>class QuickAnswersController < ApplicationController
  def show
    return render(:template => 'articles/missing') unless QuickAnswer.exists? params[:id]

    @article = QuickAnswer.find(params[:id])

    authorize! :read, @article

    #redirection of old permalinks
    if request.path != quick_answer_path(@article)
      logger.info "Old permalink: #{request.path}"
      return redirect_to @article, :status => :moved_permanently
    end

    # basic statistics on how many times an article has been accessed
    @article.delay.increment! :access_count
    @article.delay.category.increment!(:access_count) if @article.category

    unless @article.published?
      flash.now[:info] = "This article has not been published."
    end

    # handle old html articles
    unless @article.render_markdown
      @content_html = @article.content
      render :show_html and return
    end

    @content_main =  @article.md_to_html(:content_main)<commit_msg>[#77] Access counts are incremented synchronously.<commit_after>class QuickAnswersController < ApplicationController
  def show
    return render(:template => 'articles/missing') unless QuickAnswer.exists? params[:id]

    @article = QuickAnswer.find(params[:id])

    authorize! :read, @article

    #redirection of old permalinks
    if request.path != quick_answer_path(@article)
      logger.info "Old permalink: #{request.path}"
      return redirect_to @article, :status => :moved_permanently
    end

    # basic statistics on how many times an article has been accessed
    @article.increment! :access_count
    @article.category.increment!(:access_count) if @article.category

    unless @article.published?
      flash.now[:info] = "This article has not been published."
    end

    # handle old html articles
    unless @article.render_markdown
      @content_html = @article.content
      render :show_html and return
    end

    @content_main =  @article.md_to_html(:content_main)
{'fraction_non_alphanumeric': 0.09465648854961832, 'fraction_numerical': 0.0010178117048346056, 'mean_word_length': 3.8304668304668303, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1679521', 'n_tokens_mistral': 566, 'n_tokens_neox': 538, 'n_words': 152}