Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venjob_nth
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
3
Merge Requests
3
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
Ngô Trung Hưng
venjob_nth
Commits
4720630b
Commit
4720630b
authored
Aug 24, 2020
by
Ngô Trung Hưng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix method add_job_to_history
parent
e0740f33
Pipeline
#997
canceled with stages
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
app/controllers/job_controller.rb
+1
-9
config/application.rb
+2
-1
lib/business/job_business.rb
+9
-0
No files found.
app/controllers/job_controller.rb
View file @
4720630b
...
...
@@ -3,14 +3,6 @@
# Job controller
class
JobController
<
ApplicationController
before_action
:load_data_dropdown
,
only: :index
def
add_job_to_history
(
job_id
)
return
unless
user_signed_in?
current_user
.
histories
.
find_or_create_by
(
job_id:
job_id
)
counter_history
=
current_user
.
histories
.
count
current_user
.
histories
.
destroy
(
current_user
.
histories
.
first
)
if
counter_history
>
History
::
NUMBER_JOB_LIMIT
end
def
index
model
=
params
[
:model
].
classify
.
constantize
obj
=
model
.
find_by
(
slug:
params
[
:slug
])
...
...
@@ -21,7 +13,7 @@ class JobController < ApplicationController
@job
=
Job
.
find
(
params
[
:id
]).
decorate
return
render
'error/fage_not_found'
if
@job
.
blank?
add_job_to_history
(
@job
.
id
)
JobBusiness
.
add_job_to_history
(
@job
.
id
,
current_user
)
if
user_signed_in?
cities
=
@job
.
cities
.
first
industries
=
@job
.
industries
.
first
add_breadcrumb
t
(
'controller.job.detail.home'
),
root_path
...
...
config/application.rb
View file @
4720630b
...
...
@@ -13,9 +13,10 @@ module Venjob
config
.
exceptions_app
=
self
.
routes
config
.
autoload_paths
<<
Rails
.
root
.
join
(
'lib/service'
)
config
.
autoload_paths
<<
Rails
.
root
.
join
(
'lib/src'
)
config
.
autoload_paths
<<
Rails
.
root
.
join
(
'lib/business'
)
# i18n
config
.
i18n
.
available_locales
=
[
:en
,
:vi
]
config
.
i18n
.
default_locale
=
:
en
config
.
i18n
.
default_locale
=
:
vi
config
.
i18n
.
load_path
+=
Dir
[
Rails
.
root
.
join
(
'config'
,
'locales'
,
'**'
,
'*.{rb,yml}'
)]
# Settings in config/environments/* take precedence over those specified here.
...
...
lib/business/job_business.rb
0 → 100644
View file @
4720630b
# frozen_string_literal: true
class
JobBusiness
def
self
.
add_job_to_history
(
job_id
,
current_user
)
current_user
.
histories
.
find_or_create_by
(
job_id:
job_id
)
counter_history
=
current_user
.
histories
.
count
current_user
.
histories
.
destroy
(
current_user
.
histories
.
first
)
if
counter_history
>
History
::
NUMBER_JOB_LIMIT
end
end
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