<commit_before>class MiscController < ActionController::Base
  # This controller is intended for things that don't need all of the
  # complex setup that happens in ApplicationController. If you have
  # actions that don't need things like authentication, current_user,
  # etc. then you can place them here and they will execute more
  # quickly.
  # Also notably, nothing in the chain before this accesses session[],
  # so if a session does not already exist *it will not be created*
  # unless you action accesses session[].

  def banner
    learner = (params[:learner_id] ? Portal::Learner.find(params[:learner_id]) : nil)
    if learner && learner.bundle_logger.in_progress_bundle
      launch_event = Dataservice::LaunchProcessEvent.create(
        :event_type => Dataservice::LaunchProcessEvent::TYPES[:logo_image_requested],
        :event_details => "Activity launch started. Waiting for configuration...",
        :bundle_content => learner.bundle_logger.in_progress_bundle
      )
    end
    asset = get_banner_asset(APP_CONFIG[:theme])
    if asset.nil?
      asset = get_banner_asset("empty")
    end
    send_file(asset.pathname.to_s, {:type => 'image/png', :disposition => 'inline'} )
  end

  def installer_report
    body = request.body.read
    remote_ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip
    success = !!(body =~ /Succeeded! Saved and loaded jar./)
    report = InstallerReport.create(:body => body, :remote_ip => remote_ip, :success => success, 
      :jnlp_session_id => params[:jnlp_session_id])
    render :xml => "<created/>", :status => :created
  end

  def stats
    stats = {}
    stats[:teachers] = Portal::Teacher.count
    stats[:students] = Portal::Student.count
    stats[:classes] = Portal::Clazz.count
    stats[:users] = User.count
    stats[:learners] = Portal::Learner.count
    stats[:offerings] = Portal::Offering.count
    stats[:bundle_loggers] = Dataservice::BundleLogger.count
    stats[:bundle_contents] = Dataservice::BundleContent.count
    stats[:investigations] = Investigation.count
    stats[:activities] = Activity.count
    stats[:sections] = Section.count<commit_msg>use a much smaller banner image<commit_after>class MiscController < ActionController::Base
  # This controller is intended for things that don't need all of the
  # complex setup that happens in ApplicationController. If you have
  # actions that don't need things like authentication, current_user,
  # etc. then you can place them here and they will execute more
  # quickly.
  # Also notably, nothing in the chain before this accesses session[],
  # so if a session does not already exist *it will not be created*
  # unless you action accesses session[].

  def banner
    learner = (params[:learner_id] ? Portal::Learner.find(params[:learner_id]) : nil)
    if learner && learner.bundle_logger.in_progress_bundle
      launch_event = Dataservice::LaunchProcessEvent.create(
        :event_type => Dataservice::LaunchProcessEvent::TYPES[:logo_image_requested],
        :event_details => "Activity launch started. Waiting for configuration...",
        :bundle_content => learner.bundle_logger.in_progress_bundle
      )
    end
    asset = ActionController::Base.helpers.asset_paths.asset_for("cc_corner_logo.png", nil)
    send_file(asset.pathname.to_s, {:type => 'image/png', :disposition => 'inline'} )
  end

  def installer_report
    body = request.body.read
    remote_ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip
    success = !!(body =~ /Succeeded! Saved and loaded jar./)
    report = InstallerReport.create(:body => body, :remote_ip => remote_ip, :success => success, 
      :jnlp_session_id => params[:jnlp_session_id])
    render :xml => "<created/>", :status => :created
  end

  def stats
    stats = {}
    stats[:teachers] = Portal::Teacher.count
    stats[:students] = Portal::Student.count
    stats[:classes] = Portal::Clazz.count
    stats[:users] = User.count
    stats[:learners] = Portal::Learner.count
    stats[:offerings] = Portal::Offering.count
    stats[:bundle_loggers] = Dataservice::BundleLogger.count
    stats[:bundle_contents] = Dataservice::BundleContent.count
    stats[:investigations] = Investigation.count
    stats[:activities] = Activity.count
    stats[:sections] = Section.count
{'fraction_non_alphanumeric': 0.1134404845096669, 'fraction_numerical': 0.0, 'mean_word_length': 4.148681055155875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1191793', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1247, 'n_words': 326}