Class: Backend::AnalysesController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/analyses_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Class Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Class Method Details

.analyses_conditionsObject

params:

:q Text search
:s State search
:period Two Dates with _ separator
:variant_id

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/backend/analyses_controller.rb', line 30

def self.analyses_conditions
  code = ''
  code = search_conditions(entities: [:full_name], analyses: [:reference_number, :number]) + " ||= []\n"
  code << "  if params[:sampler_id].to_i > 0\n"
  code << "    c[0] << \" AND \#{Entity.table_name}.id = ?\"\n"
  code << "    c << params[:sampler_id].to_i\n"
  code << "  end\n"
  code << "  unless params[:nature].blank?\n"
  code << "    if Analysis.nature.values.include?(params[:nature].to_sym)\n"
  code << "      c[0] << ' AND #{Analysis.table_name}.nature = ?'\n"
  code << "      c << params[:nature]\n"
  code << "    end\n"
  code << "  end\n"
  code << "c\n"
  code.c
end