<commit_before># frozen_string_literal: true

json.key_format! camelize: :lower

by_id json,
      comment_threads: @comment_threads,
      comments: @comment_threads.flat_map(&:comments)

json.cards do
  @case.cards.each do |card|
    json.cache! [card, @forum] do
      json.set! card.to_param do
        json.extract! card, :id, :position, :solid, :raw_content
        json.content card.content || ''
        json.comment_threads threads_for_card(@comment_threads, card.id) do |ct|
          json.cache! ct do
            json.partial! ct
          end
        end
      end
    end
  end
end<commit_msg>Cache thread-attached cards per user as well as per forum (#97)<commit_after># frozen_string_literal: true

json.key_format! camelize: :lower

by_id json,
      comment_threads: @comment_threads,
      comments: @comment_threads.flat_map(&:comments)

json.cards do
  @case.cards.each do |card|
    json.cache! [card, @forum, current_reader] do
      json.set! card.to_param do
        json.extract! card, :id, :position, :solid, :raw_content
        json.content card.content || ''
        json.comment_threads threads_for_card(@comment_threads, card.id) do |ct|
          json.cache! ct do
            json.partial! ct
          end
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10234375, 'fraction_numerical': 0.0015625, 'mean_word_length': 2.69164265129683, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7049817', 'n_tokens_mistral': 418, 'n_tokens_neox': 406, 'n_words': 106}