<commit_before>class TermController < ApplicationController

  # get all terms
  def all_terms
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = 2)"])
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get specific term by sis id
  def term_by_sis_id
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = 2) AND (sis_source_id = '#{params[:sis_id]}')"])
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get current term
  def current_term
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = 2) AND (:date BETWEEN start_at AND end_at) AND (sis_source_id IS NOT NULL)", {:date => DateTime.now}]).first
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get next n term(s)
  def next_terms<commit_msg>replace hard-coded account id with Account.default.id<commit_after>class TermController < ApplicationController

  # get all terms
  def all_terms
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = #{Account.default.id})"])
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get specific term by sis id
  def term_by_sis_id
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = #{Account.default.id}) AND (sis_source_id = '#{params[:sis_id]}')"])
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get current term
  def current_term
    t = EnrollmentTerm.find(:all, :select => select_fields, :conditions => ["workflow_state = 'active' AND (root_account_id = #{Account.default.id}) AND (:date BETWEEN start_at AND end_at) AND (sis_source_id IS NOT NULL)", {:date => DateTime.now}]).first
    respond_to do |format|
      format.json {render :json => t}
    end
  end

  # get next n term(s)
  def next_terms
{'fraction_non_alphanumeric': 0.12698412698412698, 'fraction_numerical': 0.0014005602240896359, 'mean_word_length': 3.8815489749430525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '1690347', 'n_tokens_mistral': 711, 'n_tokens_neox': 692, 'n_words': 204}