Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
veNJOB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thanh Hung Pham
veNJOB
Commits
eedcd09e
Commit
eedcd09e
authored
Jul 19, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search complete
parent
60fdeba5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
app/controllers/admins_controller.rb
+1
-1
app/models/apply.rb
+4
-1
app/models/user.rb
+3
-0
No files found.
app/controllers/admins_controller.rb
View file @
eedcd09e
...
@@ -10,6 +10,6 @@ class AdminsController < ApplicationController
...
@@ -10,6 +10,6 @@ class AdminsController < ApplicationController
@from_date_default
=
Date
.
new
(
params
[
:from_date
][
'(1i)'
].
to_i
,
params
[
:from_date
][
'(2i)'
].
to_i
,
params
[
:from_date
][
'(3i)'
].
to_i
)
if
params
[
:from_date
].
present?
@from_date_default
=
Date
.
new
(
params
[
:from_date
][
'(1i)'
].
to_i
,
params
[
:from_date
][
'(2i)'
].
to_i
,
params
[
:from_date
][
'(3i)'
].
to_i
)
if
params
[
:from_date
].
present?
@to_date_default
=
Date
.
new
(
params
[
:to_date
][
'(1i)'
].
to_i
,
params
[
:to_date
][
'(2i)'
].
to_i
,
params
[
:to_date
][
'(3i)'
].
to_i
)
if
params
[
:to_date
].
present?
@to_date_default
=
Date
.
new
(
params
[
:to_date
][
'(1i)'
].
to_i
,
params
[
:to_date
][
'(2i)'
].
to_i
,
params
[
:to_date
][
'(3i)'
].
to_i
)
if
params
[
:to_date
].
present?
@applied_jobs
=
Apply
.
applied_at_between
(
@from_date_default
,
@to_date_default
).
page
params
[
:page
]
@applied_jobs
=
Apply
.
search_email
(
@email
).
search_city
(
@city_id
).
search_city
(
@category_id
).
applied_at_between
(
@from_date_default
,
@to_date_default
).
page
params
[
:page
]
end
end
end
end
app/models/apply.rb
View file @
eedcd09e
...
@@ -4,5 +4,8 @@ class Apply < ApplicationRecord
...
@@ -4,5 +4,8 @@ class Apply < ApplicationRecord
paginates_per
20
paginates_per
20
scope
:applied_at_between
,
->
(
from_date
,
to_date
)
{
where
(
'applied_at >= ? AND applied_at <= ?'
,
from_date
,
to_date
)
}
scope
:applied_at_between
,
->
(
from_date
,
to_date
)
{
where
(
'DATE(applied_at) >= ? AND DATE(applied_at) <= ?'
,
from_date
,
to_date
)
}
scope
:search_email
,
->
(
email
)
{
joins
(
:user
).
where
(
'? IS NULL OR users.email = ?'
,
email
,
email
)
}
scope
:search_city
,
->
(
city_id
)
{
joins
(
:job
).
where
(
'? IS NULL OR jobs.city_id = ?'
,
city_id
,
city_id
)
}
scope
:search_category
,
->
(
category_id
)
{
joins
(
job:
[
:job_category
]).
where
(
'? IS NULL OR job_categories.category_id = ?'
,
category_id
,
category_id
)
}
end
end
app/models/user.rb
View file @
eedcd09e
class
User
<
ApplicationRecord
class
User
<
ApplicationRecord
attr_accessor
:skip_password_validation
,
:skip_fullname_validation
,
:upload
attr_accessor
:skip_password_validation
,
:skip_fullname_validation
,
:upload
has_many
:applies
# Include default devise modules. Others available are:
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
# :confirmable, :lockable, :timeoutable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
devise
:database_authenticatable
,
:registerable
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment