| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -23,7 +23,11 @@ class ItemBankQuery < ApplicationQuery
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      items = items.joins(:sub_discipline).where(sub_disciplines: {discipline_id: params[:discipline_id]})
 | 
					 | 
					 | 
					 | 
					      items = items.joins(:sub_discipline).where(sub_disciplines: {discipline_id: params[:discipline_id]})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    end
 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    items = items.where(item_type: params[:item_type].to_i) if params[:item_type].present?
 | 
					 | 
					 | 
					 | 
					    if params[:oj_status].present? && params[:item_type] == "PROGRAM"
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      items = items.joins("join hacks on hacks.id=item_banks.container_id and item_banks.container_type='Hack'").where(hacks: {status: params[:oj_status]})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    end
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    items = items.where(item_type: params[:item_type]) if params[:item_type].present?
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    items = items.where(difficulty: params[:difficulty].to_i) if params[:difficulty].present?
 | 
					 | 
					 | 
					 | 
					    items = items.where(difficulty: params[:difficulty].to_i) if params[:difficulty].present?
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    items = items.where("name like ?", "%#{params[:keyword].strip}%") if params[:keyword].present?
 | 
					 | 
					 | 
					 | 
					    items = items.where("name like ?", "%#{params[:keyword].strip}%") if params[:keyword].present?
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |