app/helpers/courses_helpers.rb
def find_courses_in_sem db, semester
        res = db.exec("SELECT course_id, name, dept_id FROM courses WHERE semester=#{semester} ORDER BY course_id ASC;")
        courses = []

        res.each do |row|
          courses << row
        end

        courses
      end
# generalize logic for checking if semester param valid
generalize logic for checking if semester param valid
generalize logic for checking if semester param valid
def find_courses_in_sem db, semester
        res = db.exec("SELECT course_id, name, dept_id FROM courses WHERE semester=#{semester} ORDER BY course_id ASC;")
        courses = []
        res.each do |row|
          courses << row
        end
        courses
      end
def find_courses_in_sem db , semester res = db . exec ( "SELECT course_id, name, dept_id FROM courses WHERE semester=#{semester} ORDER BY course_id ASC;" ) courses = [ ] res . each do | row | courses << row end courses end
generalize logic for checking if semester param valid
generalize logic for checking if semester param valid
db
semester