Commit 9f4a0e4d by Ngô Trung Hưng

refactor code

parent f4191bbf
Pipeline #1111 failed with stages
in 0 seconds
...@@ -35,6 +35,7 @@ gem 'devise' ...@@ -35,6 +35,7 @@ gem 'devise'
gem 'carrierwave' gem 'carrierwave'
gem 'rails-i18n' gem 'rails-i18n'
gem 'i18n-js' gem 'i18n-js'
gem 'therubyracer'
# Use ActiveStorage variant # Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8' # gem 'mini_magick', '~> 4.8'
......
...@@ -132,6 +132,7 @@ GEM ...@@ -132,6 +132,7 @@ GEM
activerecord activerecord
kaminari-core (= 1.2.1) kaminari-core (= 1.2.1)
kaminari-core (1.2.1) kaminari-core (1.2.1)
libv8 (3.16.14.19-x86_64-linux)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
...@@ -194,6 +195,7 @@ GEM ...@@ -194,6 +195,7 @@ GEM
rb-fsevent (0.10.4) rb-fsevent (0.10.4)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
ref (2.0.0)
regexp_parser (1.7.1) regexp_parser (1.7.1)
request_store (1.5.0) request_store (1.5.0)
rack (>= 1.4) rack (>= 1.4)
...@@ -229,6 +231,9 @@ GEM ...@@ -229,6 +231,9 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (1.0.1) thor (1.0.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
...@@ -282,6 +287,7 @@ DEPENDENCIES ...@@ -282,6 +287,7 @@ DEPENDENCIES
selenium-webdriver selenium-webdriver
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)
therubyracer
turbolinks (~> 5) turbolinks (~> 5)
tzinfo-data tzinfo-data
uglifier (>= 1.3.0) uglifier (>= 1.3.0)
......
...@@ -20,6 +20,7 @@ class Admin::AdminController < ApplicationController ...@@ -20,6 +20,7 @@ class Admin::AdminController < ApplicationController
end end
def search def search
return redirect_to applies_index_path if params[:apply].blank? return redirect_to applies_index_path if params[:apply].blank?
return export_csv(result_for(params[:apply])) if params[:export_csv].present? return export_csv(result_for(params[:apply])) if params[:export_csv].present?
......
...@@ -10,20 +10,21 @@ class Apply ...@@ -10,20 +10,21 @@ class Apply
end end
def self.selected_date(params) def self.selected_date(params)
dt = {} params.present? ? {
if params.present? selected_past_year: params['past_time(1i)'].to_i,
dt[:selected_past_year] = params['past_time(1i)'].to_i selected_past_month: params['past_time(2i)'].to_i,
dt[:selected_past_month] = params['past_time(2i)'].to_i selected_past_day: params['past_time(3i)'].to_i,
dt[:selected_past_day] = params['past_time(3i)'].to_i selected_current_year: params['current_time(1i)'].to_i,
selected_current_month: params['current_time(2i)'].to_i,
dt[:selected_current_year] = params['current_time(1i)'].to_i selected_current_day: params['current_time(3i)'].to_i
dt[:selected_current_month] = params['current_time(2i)'].to_i } :
dt[:selected_current_day] = params['current_time(3i)'].to_i {
else selected_past_year: Date.current.year,
dt[:selected_past_year] = dt[:selected_current_year] = Date.current.year selected_current_year: Date.current.year,
dt[:selected_past_month] = dt[:selected_current_month] = Date.current.month selected_past_month: Date.current.month,
dt[:selected_past_day] = dt[:selected_current_day] = Date.current.day selected_current_month: Date.current.month,
end selected_past_day: Date.current.day,
dt selected_current_day: Date.current.day
}
end end
end end
...@@ -14,7 +14,7 @@ default: &default ...@@ -14,7 +14,7 @@ default: &default
encoding: utf8mb4 encoding: utf8mb4
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root username: root
password: 'Trunghung5055@' password: 1
socket: /var/run/mysqld/mysqld.sock socket: /var/run/mysqld/mysqld.sock
development: development:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment