Bugfix
This commit is contained in:
@@ -25,10 +25,11 @@ class CoursesController < ApplicationController
|
|||||||
params[:period] = nil if params[:period] == App.current_period
|
params[:period] = nil if params[:period] == App.current_period
|
||||||
@period = params[:period] || App.current_period
|
@period = params[:period] || App.current_period
|
||||||
|
|
||||||
conditions = []
|
if logged_in? and !@current_user.courses.empty?
|
||||||
conditions.add_condition!(['period = ?', @period])
|
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ? and id not in (?)', @period, @current_user.courses])
|
||||||
conditions.add_condition!(['id not in (?)', @current_user.courses]) if logged_in? and !@current_user.courses.empty?
|
else
|
||||||
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => conditions)
|
@courses = Course.find(:all, :order => 'grade asc, full_name asc', :conditions => ['period = ?', @period])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
Reference in New Issue
Block a user