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'
gem 'carrierwave'
gem 'rails-i18n'
gem 'i18n-js'
gem 'therubyracer'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
......
......@@ -132,6 +132,7 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
libv8 (3.16.14.19-x86_64-linux)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
......@@ -194,6 +195,7 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
ref (2.0.0)
regexp_parser (1.7.1)
request_store (1.5.0)
rack (>= 1.4)
......@@ -229,6 +231,9 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
......@@ -282,6 +287,7 @@ DEPENDENCIES
selenium-webdriver
spring
spring-watcher-listen (~> 2.0.0)
therubyracer
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
......
......@@ -20,6 +20,7 @@ class Admin::AdminController < ApplicationController
end
def search
return redirect_to applies_index_path if params[:apply].blank?
return export_csv(result_for(params[:apply])) if params[:export_csv].present?
......
......@@ -10,20 +10,21 @@ class Apply
end
def self.selected_date(params)
dt = {}
if params.present?
dt[:selected_past_year] = params['past_time(1i)'].to_i
dt[:selected_past_month] = params['past_time(2i)'].to_i
dt[:selected_past_day] = params['past_time(3i)'].to_i
dt[:selected_current_year] = params['current_time(1i)'].to_i
dt[:selected_current_month] = params['current_time(2i)'].to_i
dt[:selected_current_day] = params['current_time(3i)'].to_i
else
dt[:selected_past_year] = dt[:selected_current_year] = Date.current.year
dt[:selected_past_month] = dt[:selected_current_month] = Date.current.month
dt[:selected_past_day] = dt[:selected_current_day] = Date.current.day
end
dt
params.present? ? {
selected_past_year: params['past_time(1i)'].to_i,
selected_past_month: params['past_time(2i)'].to_i,
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,
selected_current_day: params['current_time(3i)'].to_i
} :
{
selected_past_year: Date.current.year,
selected_current_year: Date.current.year,
selected_past_month: Date.current.month,
selected_current_month: Date.current.month,
selected_past_day: Date.current.day,
selected_current_day: Date.current.day
}
end
end
......@@ -14,7 +14,7 @@ default: &default
encoding: utf8mb4
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: 'Trunghung5055@'
password: 1
socket: /var/run/mysqld/mysqld.sock
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