Showing 7 of 13 total issues
Class AdminsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class AdminsController < ApplicationController layout 'admin_layout', :only => [:home, :update_semester, :updateCurrentSemester, :rating_tutors, :tutor_hours, :update_password, :update_student_priorities, :manage_tutors, :manage_semester, :update_question_templates] before_action :set_admin, except: [:landing, :destroyAdminSession] before_action :check_logged_in, except: [:landing, :createAdminSession, :destroyAdminSession]
Method batch_update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def batch_update new_ordering = [] params.keys.each do |k| if k.include?('qt') #second split by _ index is always the qt id value, a la qt_#{qt.index}_etcetc
Method set_tutor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_tutor if params[:id] == "sign_out" || params[:id] == "new" redirect_to new_tutor_session_path elsif params[:id] == "password" redirect_to new_tutor_password_path
- Read upRead up
Method check_valid_tutee
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_valid_tutee #I'm so sorry, but this is what they left me and I didn't have time to fix it. #We need to either commit fully to Devise or just don't, cause this is what happens when you try to validate across forms, #posts, gets, etc. and everything is split between param ids, nested resource ids, session checks, etc. if ['tutees','tutees/registrations'].include? params[:controller] and current_tutee&.id.to_i == params[:id].to_i
- Read upRead up
Method edit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def edit @tutee = Tutee.find params[:tutee_id] @evaluation = Evaluation.friendly.find params[:id] @meeting = Meeting.where("evaluation_id = ?", @evaluation.id).first if not @meeting.nil? and not @meeting.set_time.nil?
- Read upRead up
Method create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create # Checks if parameters are good if request_params[:subject].blank? flash[:notice] = "Invalid request: Subject should be filled out."
- Read upRead up
Method update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update @evaluation = Evaluation.friendly.find params[:id] took_place = (params['hours'].to_d > 0) @evaluation.update(took_place: took_place, course: params['course'], hours: params['hours'], status: "Complete") #in case the tutor hasn't marked it as done yet, tutee submitting an evaluation will.
- Read upRead up