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
1
Merge Requests
1
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
Tô Ngọc Ánh
VeNJob
Commits
e54b8a31
Commit
e54b8a31
authored
Sep 11, 2020
by
Tô Ngọc Ánh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug can't access /admin/applies
parent
4552c30b
Pipeline
#1095
failed with stages
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
app/models/applied_job.rb
+1
-0
app/services/search_applied_jobs_service.rb
+6
-1
No files found.
app/models/applied_job.rb
View file @
e54b8a31
class
AppliedJob
<
ApplicationRecord
scope
:of_email
,
->
(
email
)
{
where
(
email:
email
)
if
email
.
present?
}
scope
:order_desc
,
->
{
order
(
created_at: :desc
)
}
EMAIL_REGEXN
=
/\A[a-zA-Z][\w\.]+@[a-zA-Z]+\.[a-zA-Z]+\z/
CSV_ATTRIBUTES
=
%w(job_id job_title email full_name curriculum_vitae created_at)
.
freeze
...
...
app/services/search_applied_jobs_service.rb
View file @
e54b8a31
...
...
@@ -2,7 +2,11 @@ module SearchAppliedJobsService
def
self
.
search
(
params
)
date
=
{}
if
params
[
:email
].
nil?
applied_jobs
=
AppliedJob
.
includes
(
:job
).
order
(
created_at: :desc
).
page
(
params
[
:page
]).
decorate
applied_jobs
=
AppliedJob
.
joins
(
:job
)
.
select
(
"applied_jobs.*, jobs.title as job_title"
)
.
order_desc
.
page
(
params
[
:page
])
.
decorate
date
[
:from
]
=
Date
.
today
date
[
:to
]
=
Date
.
today
else
...
...
@@ -13,6 +17,7 @@ module SearchAppliedJobsService
.
select
(
"applied_jobs.*, jobs.title as job_title"
)
.
of_email
(
params
[
:email
])
.
where
(
created_at:
date
[
:from
]
..
date
[
:to
],
job_id:
job_ids
)
.
order_desc
.
page
(
params
[
:page
])
end
[
date
,
applied_jobs
]
...
...
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