Fix sort for experiments page [SCI-5479]

This commit is contained in:
aignatov-bio 2021-02-11 15:38:10 +01:00
parent 1eff3494fb
commit bcc9d6c85c

View file

@ -11,13 +11,13 @@ class ProjectsController < ApplicationController
helper_method :current_folder
before_action :switch_team_with_param, only: :index
before_action :load_vars, only: %i(show edit update notifications experiment_archive sidebar experiments_cards)
before_action :load_current_folder, only: %i(index cards new show experiment_archive)
before_action :check_view_permissions, only: %i(show notifications experiment_archive sidebar experiments_cards)
before_action :load_vars, only: %i(show edit update notifications sidebar experiments_cards)
before_action :load_current_folder, only: %i(index cards new show)
before_action :check_view_permissions, only: %i(show notifications sidebar experiments_cards)
before_action :check_create_permissions, only: %i(new create)
before_action :check_manage_permissions, only: :edit
before_action :set_inline_name_editing, only: %i(show)
before_action :load_exp_sort_var, only: %i(show experiment_archive)
before_action :load_exp_sort_var, only: %i(show)
before_action :reset_invalid_view_state, only: %i(index cards)
layout 'fluid'
@ -258,6 +258,9 @@ class ProjectsController < ApplicationController
def show
# This is the "info" view
current_team_switch(@project.team)
view_state = @project.current_view_state(current_user)
@current_sort = view_state.state.dig('experiments', experiments_view_mode(@project), 'sort') || 'atoz'
end
def experiments_cards
@ -287,10 +290,6 @@ class ProjectsController < ApplicationController
end
end
def experiment_archive
current_team_switch(@project.team)
end
def users_filter
users = current_team.users.search(false, params[:query]).map do |u|
{ value: u.id, label: sanitize_input(u.name), params: { avatar_url: avatar_path(u, :icon_small) } }
@ -349,7 +348,6 @@ class ProjectsController < ApplicationController
@project.save
end
@current_sort = @project.experiments_order || 'new'
@current_sort = 'new' if @current_sort.include?('arch')
end
def filters_included?