app/helpers/courses_helpers.rb
# Takes a course row from the database and formats it into a response
Takes a course row from the database and formats it into a response
Takes a course row from the database and formats it into a response
def clean_course db, semester, row
        row['sections'] = find_sections_for_course db, semester, row['course_id'], params[:expand]
        row['grading_method'] = PG::TextDecoder::Array.new.decode(row['grading_method'])
        row['gen_ed'] = PG::TextDecoder::Array.new.decode(row['gen_ed'])
        row['core'] = PG::TextDecoder::Array.new.decode(row['core'])
        row['relationships'] = ::JSON.parse(row['relationships'])
        row.delete('id')
        row
      end
def clean_course db , semester , row row [ 'sections' ] = find_sections_for_course db , semester , row [ 'course_id' ] , params [ :expand ] row [ 'grading_method' ] = PG :: TextDecoder :: Array . new . decode ( row [ 'grading_method' ] ) row [ 'gen_ed' ] = PG :: TextDecoder :: Array . new . decode ( row [ 'gen_ed' ] ) row [ 'core' ] = PG :: TextDecoder :: Array . new . decode ( row [ 'core' ] ) row [ 'relationships' ] = :: JSON . parse ( row [ 'relationships' ] ) row . delete ( 'id' ) row end
Takes a course row from the database and formats it into a response
Takes a course row from the database and formats it into a response
db
semester
row