mirror of
https://github.com/chenasraf/snpr.git
synced 2026-05-18 01:39:01 +00:00
Update snps_controller.rb
quickly fixed my own code review to get the ball rolling. :)
This commit is contained in:
committed by
GitHub
parent
9e9ec11f6f
commit
b20323f34e
@@ -1,12 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
class SnpsController < ApplicationController
|
||||
helper_method :sort_column, :sort_direction
|
||||
before_filter :find_snp, except: [:index, :json,:json_annotation]
|
||||
|
||||
def index
|
||||
params.delete(:sort)
|
||||
params.delete(:direction)
|
||||
@snps = Snp.order(sort_column + ' ' + sort_direction)
|
||||
@snps = Snp.order(ranking: :desc)
|
||||
@snps_paginate = @snps.paginate(page: params[:page], per_page: 10)
|
||||
@title = 'Listing all SNPs'
|
||||
end
|
||||
@@ -177,15 +176,7 @@ class SnpsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sort_column
|
||||
Snp.column_names.include?(params[:sort]) ? params[:sort] : 'ranking'
|
||||
end
|
||||
|
||||
def sort_direction
|
||||
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'desc'
|
||||
end
|
||||
|
||||
|
||||
def json_element(params)
|
||||
# TODO: Refactor this. - Helge
|
||||
@result = {}
|
||||
|
||||
Reference in New Issue
Block a user