lib/students_search_helper.rb
# returns a list of database IDs matching the passed request hash
returns a list of database IDs matching the passed request hash
returns a list of database IDs matching the passed request hash
def students_find(request)
    conditions = ["(users.privilege = #{User::PRIVILEGE_STUDENT}) AND (users.date_inactive IS NULL OR users.date_inactive >= ?) AND (users.date_active <= ?)"]
    arguments = [Date.new(@school_year_filter,coor_term.months.first.month).end_of_month,Date.new(@school_year_filter+1, coor_term.months.last.month)]
    if request[:na]
      conditions << "((users.last_name like ?) or (users.first_name like ?) or (users.nickname like ?))"
      3.times{ arguments << "%#{request[:na]}%"}
    end
    case request[:co]
    when -1
    when -2
      conditions << "(users.coordinator_id is null)"
    else
      conditions << "(users.coordinator_id = ?)"
      arguments << request[:co]
    end
    case request[:cl]
    when "", -1
    else
      conditions << "(users.district_grade = ?)"
      arguments << request[:cl]
    end
    students = User.find(:all, :include => [:coordinator], :conditions => [conditions.join(' and ')]+arguments, :order => 'users.last_name, users.first_name')
  end
def students_find ( request ) conditions = [ "(users.privilege = #{User::PRIVILEGE_STUDENT}) AND (users.date_inactive IS NULL OR users.date_inactive >= ?) AND (users.date_active <= ?)" ] arguments = [ Date . new ( @school_year_filter , coor_term . months . first . month ) . end_of_month , Date . new ( @school_year_filter + 1 , coor_term . months . last . month ) ] if request [ :na ] conditions << "((users.last_name like ?) or (users.first_name like ?) or (users.nickname like ?))" 3 . times { arguments << "%#{request[:na]}%" } end case request [ :co ] when - 1 when - 2 conditions << "(users.coordinator_id is null)" else conditions << "(users.coordinator_id = ?)" arguments << request [ :co ] end case request [ :cl ] when "" , - 1 else conditions << "(users.district_grade = ?)" arguments << request [ :cl ] end students = User . find ( :all , :include => [ :coordinator ] , :conditions => [ conditions . join ( ' and ' ) ] + arguments , :order => 'users.last_name, users.first_name' ) end
returns a list of database IDs matching the passed request hash
returns a list of database IDs matching the passed request hash
# nothing added for full range # unassigned
request
<not_specific>