<commit_before>class SchoolsController < ApplicationController
  include SerializeDataHelper
  include StudentsQueryHelper

  before_action :authenticate_educator!,
                :authorize

  def show
    if current_educator.districtwide_access?
      authorized_students = @school.students
    else
      authorized_students = current_educator.students_for_school_overview
    end

    # TODO(kr) Read from cache, since this only updates daily
    student_hashes = log_timing('schools#show student_hashes') do
      load_precomputed_student_hashes(Time.now, authorized_students.map(&:id))
    end

    # Read data stored StudentInsights each time, with no caching
    merged_student_hashes = log_timing('schools#show merge_mutable_fields_for_slicing') do
      merge_mutable_fields_for_slicing(student_hashes)
    end

    @serialized_data = {<commit_msg>Only load Active students when districtwide user logged in<commit_after>class SchoolsController < ApplicationController
  include SerializeDataHelper
  include StudentsQueryHelper

  before_action :authenticate_educator!,
                :authorize

  def show
    if current_educator.districtwide_access?
      authorized_students = @school.students.active
    else
      authorized_students = current_educator.students_for_school_overview
    end

    # TODO(kr) Read from cache, since this only updates daily
    student_hashes = log_timing('schools#show student_hashes') do
      load_precomputed_student_hashes(Time.now, authorized_students.map(&:id))
    end

    # Read data stored StudentInsights each time, with no caching
    merged_student_hashes = log_timing('schools#show merge_mutable_fields_for_slicing') do
      merge_mutable_fields_for_slicing(student_hashes)
    end

    @serialized_data = {
{'fraction_non_alphanumeric': 0.05367231638418079, 'fraction_numerical': 0.0, 'mean_word_length': 4.432515337423313, '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': '393964', 'n_tokens_mistral': 522, 'n_tokens_neox': 503, 'n_words': 112}