<commit_before>class Teachers::ProgressReports::Standards::ClassroomTopicsController < Teachers::ProgressReportsController
  include UnitsWithCompletedActivities

  def index
    respond_to do |format|
      format.html
      format.json do
        topics = ::ProgressReports::Standards::Topic.new(current_user).results(params)
        topics_json = topics.map do |topic|
          serializer = ::ProgressReports::Standards::TopicSerializer.new(topic)
          # Doing this because can't figure out how to get custom params into serializers
          serializer.classroom_id = params[:classroom_id]
          serializer.as_json(root: false)
        end

        cas = Classroom.where(id: params[:classroom_id]).includes(:classroom_activities).map(&:classroom_activities).flatten<commit_msg>Return 401 unless this teacher has access to this classroom<commit_after>class Teachers::ProgressReports::Standards::ClassroomTopicsController < Teachers::ProgressReportsController
  include UnitsWithCompletedActivities

  def index
    respond_to do |format|
      format.html
      format.json do
        return render json: {}, status: 401 unless current_user.classrooms_i_teach.map(&:id).include?(params[:classroom_id])

        topics = ::ProgressReports::Standards::Topic.new(current_user).results(params)
        topics_json = topics.map do |topic|
          serializer = ::ProgressReports::Standards::TopicSerializer.new(topic)
          # Doing this because can't figure out how to get custom params into serializers
          serializer.classroom_id = params[:classroom_id]
          serializer.as_json(root: false)
        end

        cas = Classroom.where(id: params[:classroom_id]).includes(:classroom_activities).map(&:classroom_activities).flatten
{'fraction_non_alphanumeric': 0.09236031927023945, 'fraction_numerical': 0.0034207525655644243, 'mean_word_length': 4.1923076923076925, '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': '6275803', 'n_tokens_mistral': 482, 'n_tokens_neox': 465, 'n_words': 99}