<commit_before>class DashboardController <  GroupBaseController
  include ApplicationHelper

  def show
    @discussions = GroupDiscussionsViewer.for(user: current_user)

    if sifting_unread?
      @discussions = @discussions.unread
    end

    if sifting_followed?
      @discussions = @discussions.following
    end

    @discussions = @discussions.joined_to_current_motion.
                                preload(:current_motion, {group: :parent}).
                                order('motions.closing_at ASC, last_comment_at DESC').
                                page(params[:page]).per(20)
    build_discussion_index_caches

    # on discussion, preload author, current_motion -> author, votes
    # load discussion_readers for discussion, user and store in a hash key: discussion_id
    # preload motion_readers for user, discussions -> current_motions
  end
end
<commit_msg>order by closing soon , latest acitvity<commit_after>class DashboardController <  GroupBaseController
  include ApplicationHelper

  def show
    @discussions = GroupDiscussionsViewer.for(user: current_user)

    if sifting_unread?
      @discussions = @discussions.unread
    end

    if sifting_followed?
      @discussions = @discussions.following
    end

    @discussions = @discussions.joined_to_current_motion.
                                preload(:current_motion, {group: :parent}).
                                order_by_closing_soon_then_latest_activity.
                                page(params[:page]).per(20)
    build_discussion_index_caches

    # on discussion, preload author, current_motion -> author, votes
    # load discussion_readers for discussion, user and store in a hash key: discussion_id
    # preload motion_readers for user, discussions -> current_motions
  end
end

{'fraction_non_alphanumeric': 0.06636921360847742, 'fraction_numerical': 0.002230897936419409, 'mean_word_length': 2.72972972972973, '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': '1871394', 'n_tokens_mistral': 524, 'n_tokens_neox': 476, 'n_words': 118}