Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
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 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Nguyen Hoang Mai Phuong
  • VeNJOB
  • Merge Requests
  • !10

Merged
Opened Sep 01, 2021 by Nguyen Hoang Mai Phuong@phuongnhm 
  • Report abuse
Report abuse

favorite-history funtion

×

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b favorite-history origin/favorite-history

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git checkout master
git merge --no-ff favorite-history

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 22
  • Commits 14
  • Pipelines 14
  • Changes 32
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • eba9e791 - add link_to to title favorite history

    Compare with previous version

    Sep 01, 2021

    added 1 commit

    • eba9e791 - add link_to to title favorite history

    Compare with previous version

    added 1 commit * eba9e791 - add link_to to title favorite history [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5453&start_sha=3b6d926109c59d466d357a37e491826f6d46868c)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 35b9860b - refactor code with object query and remove jquery gem

    Compare with previous version

    Sep 07, 2021

    added 1 commit

    • 35b9860b - refactor code with object query and remove jquery gem

    Compare with previous version

    added 1 commit * 35b9860b - refactor code with object query and remove jquery gem [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5456&start_sha=eba9e791f2efb8a901d48505cc0b8a9444a5709d)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    Gemfile
    4 4 ruby '3.0.1'
    5 5
    6 6 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
    7 # gem 'bullet', group: 'development'
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Xóa code không dùng nè em.

      @phuongnhm Xóa code không dùng nè em.
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#de3150c01c3a946a6168173c4116741379fe3579_7_7)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    Gemfile
    14 15 gem 'active_storage_validations'
    15 16 gem 'mini_magick', '>= 4.9.5'
    16 17 gem 'devise'
    18 gem 'bullet', group: 'development'
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm bỏ vào group development ở dưới luôn nha em

      @phuongnhm bỏ vào `group development` ở dưới luôn nha em
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#de3150c01c3a946a6168173c4116741379fe3579_18_17)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def show
    3 @favorites = JobsQuery.new.order_favorite(current_user).page(params[:page])
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Mỗi lần em dùng JobsQuery đều phải new mới. Mình có thể refactor lại như vậy

      def job_query
        @job_query ||= JobQuery.new
      end
      • chỗ nào cần dùng thì chỉ cần gọi job_query thôi. Ví dụ:
      @favorites = job_query.order_favorite(current_user).page(params[:page])
      @phuongnhm Mỗi lần em dùng `JobsQuery` đều phải `new` mới. Mình có thể refactor lại như vậy ``` def job_query @job_query ||= JobQuery.new end ``` - chỗ nào cần dùng thì chỉ cần gọi `job_query` thôi. Ví dụ: ``` @favorites = job_query.order_favorite(current_user).page(params[:page]) ```
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_3_2)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def show
    3 @favorites = JobsQuery.new.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = JobsQuery.new.find_favorite(job_params, current_user)
    8 if favorite == []
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Chỗ này favorite == [] cần thiết không em?

      @phuongnhm Chỗ này `favorite == []` cần thiết không em?
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_8_7)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def show
    3 @favorites = JobsQuery.new.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = JobsQuery.new.find_favorite(job_params, current_user)
    8 if favorite == []
    9 FavoriteJob.create(job: Job.find(params[:job_id]), user: current_user)
    10 @favorite_exists = true
    11 else
    12 JobsQuery.new.find_favorite(job_params, current_user).first.destroy
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Ở trên mình có lấy giá trị rồi nè. Sao không dùng lại?

      favorite = JobsQuery.new.find_favorite(job_params, current_user)
      @phuongnhm Ở trên mình có lấy giá trị rồi nè. Sao không dùng lại? ``` favorite = JobsQuery.new.find_favorite(job_params, current_user) ```
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_12_12)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def show
    3 @favorites = JobsQuery.new.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = JobsQuery.new.find_favorite(job_params, current_user)
    8 if favorite == []
    9 FavoriteJob.create(job: Job.find(params[:job_id]), user: current_user)
    10 @favorite_exists = true
    11 else
    12 JobsQuery.new.find_favorite(job_params, current_user).first.destroy
    13 @favorite_exists = false
    14 end
    15 respond_to do |format|
    16 format.html {}
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Cần response này không em?

      @phuongnhm Cần response này không em?
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_16_16)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/queries/jobs_query.rb 0 → 100644
    1 class JobsQuery
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Em nên tách class này ra làm 2 để tuân thủ Single Responsibility Principle

      • Ở đây Class của em handle nhiều vừa history vừa favorite.
      • Có thể tách ra riêng FavoriteQuery và HistoryQuery` chẳng hạn.

      • Tham khảo: https://codingitwrong.com/2015/11/30/single-responsiblity-principle-and-the-history-of-rails-architecture.html

      @phuongnhm Em nên tách class này ra làm 2 để tuân thủ `Single Responsibility Principle` - Ở đây Class của em handle nhiều vừa history vừa favorite. - Có thể tách ra riêng `FavoriteQuery` và HistoryQuery` chẳng hạn. - Tham khảo: https://codingitwrong.com/2015/11/30/single-responsiblity-principle-and-the-history-of-rails-architecture.html
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#e1696abd72380c3b9879adac225dd0c6c36254c2_1_0)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 07, 2021
    app/views/history_jobs/show.html.slim 0 → 100644
    7 .row.bg-white
    8 .col-1.p-3.border.card-body.text-dark.text-center
    9 = f.radio_button :job_id, history.job.id, class: "form-check-input mt-0"
    10 .col-11.p-3.border.card-body.text-dark
    11 h5.mb-1
    12 = link_to history.job.title, detail_path(history.job.slug)
    13 p.mb-1
    14 i.fas.fa-dollar-sign.m-1
    15 | Lương:
    16 = history.job.salary
    17 p.mb-1
    18 i.fas.fa-map-marker-alt.m-1
    19 = history.job.cities.map(&:name).uniq.join(' | ')
    20 p.mb-1
    21 = truncate(history.job.overview, length: 250)
    22 -if @histories.any?
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Dư space ở cuối dòng

      @phuongnhm Dư space ở cuối dòng
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 4 of the diff

      Sep 07, 2021

      changed this line in version 4 of the diff

      changed this line in [version 4 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991#addc4be5ef4cc043f0a1aa26adb3721de8dd4033_22_0)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 3a6eb86b - refactor code base on solid s

    Compare with previous version

    Sep 07, 2021

    added 1 commit

    • 3a6eb86b - refactor code base on solid s

    Compare with previous version

    added 1 commit * 3a6eb86b - refactor code base on solid s [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5458&start_sha=35b9860b0268b73047ed1a2436514e37cdd53991)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    resolved all discussions

    Sep 07, 2021

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    17 end
    18 end
    19
    20 def destroy
    21 @favorite = job_query.find_favorite(job_params, current_user).first.destroy
    22 redirect_to favorite_url
    23 flash[:success] = "#{@favorite.job.title} was completed and destroyed."
    24 end
    25
    26 private
    27
    28 def job_params
    29 params.permit(:job_id)
    30 end
    31
    32 def job_query
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Sửa tên method lại cho phù hợp nè em favorite_query

      @phuongnhm Sửa tên method lại cho phù hợp nè em `favorite_query`
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 6 of the diff

      Sep 08, 2021

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_32_36)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/queries/favorite_query.rb 0 → 100644
    1 class FavoriteQuery
    2 def initialize(favorites = FavoriteJob)
    3 @favorites = favorites.includes(job: %i[cities cities_jobs])
    4 end
    5
    6 def find_favorite(params, current_user)
    7 @favorites.where(job: Job.find(params[:job_id]), user: current_user)
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Sao chỗ này lại dùng where ta?

      • Nếu đúng logic thì [job, user] thì sẽ không trùng nhau được. Nên mình có thể dùng find_by
      @phuongnhm Sao chỗ này lại dùng `where` ta? - Nếu đúng logic thì [job, user] thì sẽ không trùng nhau được. Nên mình có thể dùng `find_by`
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 6 of the diff

      Sep 08, 2021

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad#d70e7fd60e6f8e2fa82e0f72c0fda9c18e57b865_7_7)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 7a5094b1 - remove authenticate

    Compare with previous version

    Sep 07, 2021

    added 1 commit

    • 7a5094b1 - remove authenticate

    Compare with previous version

    added 1 commit * 7a5094b1 - remove authenticate [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5459&start_sha=3a6eb86b4977e4d036684deb0b562e74b43e5476)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def index
    3 @favorites = job_query.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = job_query.find_favorite(job_params, current_user)
    8 if favorite.empty?
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Em sửa lại dùng find_by thì chỗ này chỉ cần if favorite là được rồi

      @phuongnhm Em sửa lại dùng `find_by` thì chỗ này chỉ cần `if favorite` là được rồi
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 6 of the diff

      Sep 08, 2021

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_8_9)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def index
    3 @favorites = job_query.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = job_query.find_favorite(job_params, current_user)
    8 if favorite.empty?
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Em sửa lại dùng find_by thì chỗ này chỉ cần if favorite là được rồi

      @phuongnhm Em sửa lại dùng `find_by` thì chỗ này chỉ cần `if favorite` là được rồi
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 6 of the diff

      Sep 08, 2021

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_8_9)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 07, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    1 class FavoriteJobsController < ApplicationController
    2 def index
    3 @favorites = job_query.order_favorite(current_user).page(params[:page])
    4 end
    5
    6 def update
    7 favorite = job_query.find_favorite(job_params, current_user)
    • Thanh Hung Pham @hungpt commented Sep 07, 2021
      Master

      @phuongnhm Anh nói rồi cái gì từ params thì mình điều phải kiểm tra

      • Em nên kiểm tra job_id có tồn tại không ?
      • Thêm 1 cái nữa nên kiểm tra current_user có hay không ? Nếu có thì chạy tiếp, còn không thì đẩy người dùng vào Login page
      @phuongnhm Anh nói rồi cái gì từ params thì mình điều phải kiểm tra - Em nên kiểm tra `job_id` có tồn tại không ? - Thêm 1 cái nữa nên kiểm tra `current_user` có hay không ? Nếu có thì chạy tiếp, còn không thì đẩy người dùng vào Login page
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 6 of the diff

      Sep 08, 2021

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_7_9)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 294232a1 - fix reviews

    Compare with previous version

    Sep 08, 2021

    added 1 commit

    • 294232a1 - fix reviews

    Compare with previous version

    added 1 commit * 294232a1 - fix reviews [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5460&start_sha=7a5094b16197382ca92f89af45b93eaa35a0e8ad)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 08, 2021
    Last updated by Nguyen Hoang Mai Phuong Sep 09, 2021
    app/views/jobs/index.html.slim
    27 27 = link_to job.cities.map(&:name).uniq.join(' | '), "#"
    28 28 p.mb-1
    29 29 = truncate(job.overview, length: 250)
    30 .col-sm-2.p-3.border.favourite
    31 = link_to "Farourite", "#", class: "btn btn-outline-primary"
    30 .col-sm-2.p-3.favourite
    31 -unless current_user.favorite_jobs.exists?(job.id)
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm

      • Chỗ này bị lỗi với case chưa login nha em.
      • Nên move check logic này vào trong model User. Screenshot_from_2021-09-08_18-38-18
      @phuongnhm - Chỗ này bị lỗi với case chưa login nha em. - Nên move check logic này vào trong model User. ![Screenshot_from_2021-09-08_18-38-18](/uploads/af4c2dac951c3c5e19f7335b986a9d06/Screenshot_from_2021-09-08_18-38-18.png)
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 7 of the diff

      Sep 09, 2021

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5462&start_sha=294232a178dfe2df44be6a55727ef9d4fdebbd7b#7aab1963773242ab7021ef6dba7810758f4405eb_31_31)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 08, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    4 def index
    5 @favorites = favorite_query.order_favorite(current_user).page(params[:page])
    6 end
    7
    8 def update
    9 job = Job.find_by(id: params[:job_id]) or not_found
    10 favorite = favorite_query.find_favorite(job_params, current_user)
    11 if favorite.nil?
    12 FavoriteJob.create(job: job, user: current_user)
    13 @favorite_exists = true
    14 else
    15 favorite.destroy
    16 @favorite_exists = false
    17 end
    18 respond_to do |format|
    19 format.html { redirect_to new_user_session_path, alert: 'Please sign in.' }
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Nên báo message này cho đồng bộ project của mình nha em. You need to sign in or sign up before continuing.

      @phuongnhm Nên báo message này cho đồng bộ project của mình nha em. `You need to sign in or sign up before continuing.`
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 7 of the diff

      Sep 09, 2021

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5462&start_sha=294232a178dfe2df44be6a55727ef9d4fdebbd7b#fc6e73ffc64a55ffed3d5d7796eeb43f6827996e_19_19)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on the diff Sep 08, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 09, 2021
    app/controllers/favorite_jobs_controller.rb 0 → 100644
    9 job = Job.find_by(id: params[:job_id]) or not_found
    10 favorite = favorite_query.find_favorite(job_params, current_user)
    11 if favorite.nil?
    12 FavoriteJob.create(job: job, user: current_user)
    13 @favorite_exists = true
    14 else
    15 favorite.destroy
    16 @favorite_exists = false
    17 end
    18 respond_to do |format|
    19 format.html { redirect_to new_user_session_path, alert: 'Please sign in.' }
    20 format.js {}
    21 end
    22 end
    23
    24 def destroy
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Tương tự, chỗ này cũng nên check Job tồn tại nha em.

      • Chỗ này mình sẽ move vào before_action để dùng cho 2 actions update và destroy nha em.
      @phuongnhm Tương tự, chỗ này cũng nên check Job tồn tại nha em. - Chỗ này mình sẽ move vào `before_action` để dùng cho 2 actions `update` và `destroy` nha em.
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 08, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/controllers/jobs_controller.rb
    16 19 def show
    17 @job = Job.latest_jobs.find_by(slug: params[:job_slug])
    20 @job = Job.find_by(slug: params[:job_slug]) or not_found
    21 @favorite_exists = !FavoriteJob.find_by(job: @job, user: current_user).nil?
    22 end
    23
    24 private
    25
    26 def history_action
    27 history = history_query.find_history(job_params, current_user)
    28 if history.nil?
    29 HistoryJob.create(job: Job.find(params[:job_slug]), user: current_user)
    30 else
    31 history.touch(:updated_at)
    32 end
    33 HistoryJob.first.destroy if HistoryJob.count > 20
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Chỗ này review nhiều lần rồi nha em. Mấy số cố định vậy nên khai báo constant nha em

      @phuongnhm Chỗ này review nhiều lần rồi nha em. Mấy số cố định vậy nên khai báo constant nha em
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 7 of the diff

      Sep 09, 2021

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5462&start_sha=294232a178dfe2df44be6a55727ef9d4fdebbd7b#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_33_33)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 08, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 08, 2021
    app/helpers/application_helper.rb
    24 24 def render_404
    25 25 render file: "#{Rails.root}/public/404.html", status: :not_found
    26 26 end
    27
    28 def favorite_text
    29 return @favorite_exists ? 'Unfavorite' : 'Favorite'
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Method trong ruby không cần return nha em

      • Tham khảo: http://ruby-for-beginners.rubymonstas.org/writing_methods/return_values.html
      @phuongnhm Method trong ruby không cần `return` nha em - Tham khảo: http://ruby-for-beginners.rubymonstas.org/writing_methods/return_values.html
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 7 of the diff

      Sep 09, 2021

      changed this line in version 7 of the diff

      changed this line in [version 7 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5462&start_sha=294232a178dfe2df44be6a55727ef9d4fdebbd7b#040453e670f9bf522378f941c96f3881076fee1f_29_29)
      Toggle commit list
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on the diff Sep 08, 2021
    Resolved by Thanh Hung Pham Sep 09, 2021
    app/views/favorite_jobs/index.html.slim 0 → 100644
    1 - provide :title, 'Favorite jobs'
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Xem lại CSS nha em. Xấu quá :))

      • Cho cái khung nhỏ lại
      • Cái check aligh center như cái button Remove sẽ đẹp hơn Screenshot_from_2021-09-08_19-16-00
      Edited Sep 09, 2021 by Thanh Hung Pham
      @phuongnhm Xem lại CSS nha em. Xấu quá :)) - Cho cái khung nhỏ lại - Cái check aligh center như cái button `Remove` sẽ đẹp hơn ![Screenshot_from_2021-09-08_19-16-00](/uploads/e7d41ee47249c78f33e42889ca4aa641/Screenshot_from_2021-09-08_19-16-00.png)
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Anh nhấn Remove bị lỗi nha. Screenshot_from_2021-09-08_19-18-30

      Edited Sep 09, 2021
      @phuongnhm Anh nhấn `Remove` bị lỗi nha. ![Screenshot_from_2021-09-08_19-18-30](/uploads/ff63e69c73673831bc2824dca97fe8a6/Screenshot_from_2021-09-08_19-18-30.png)
    Please register or sign in to reply
  • Thanh Hung Pham
    @hungpt started a discussion on the diff Sep 08, 2021
    Resolved by Nguyen Hoang Mai Phuong Sep 09, 2021
    app/views/favorite_jobs/index.html.slim 0 → 100644
    17 | Lương:
    18 = favorite.job.salary
    19 p.mb-1
    20 i.fas.fa-map-marker-alt.m-1
    21 = favorite.job.cities.map(&:name).uniq.join(' | ')
    22 p.mb-1
    23 = truncate(favorite.job.overview, length: 250)
    24 .col-sm-2.p-3.border.favourite
    25 = link_to "Remove", unfavorite_path(job_id: favorite.job.id), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-outline-primary"
    26 -if @favorites.any?
    27 h6.offset-md-4.p-2
    28 = page_entries_info @favorites
    29 .col-6.offset-md-5.text-center
    30 = paginate @favorites, window: 1
    31 .span.p-3.text-center
    32 = f.submit "Apply job", class: "btn btn-primary btn-lg"
    • Thanh Hung Pham @hungpt commented Sep 08, 2021
      Master

      @phuongnhm Em suy nghĩ thêm chô này nha.

      • Khi chưa check mà nhấn button Apply job, nên require người dùng phải check nha em
      @phuongnhm Em suy nghĩ thêm chô này nha. - Khi chưa check mà nhấn button `Apply job`, nên require người dùng phải check nha em
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • bddaf152 - fix reviews

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • bddaf152 - fix reviews

    Compare with previous version

    added 1 commit * bddaf152 - fix reviews [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5462&start_sha=294232a178dfe2df44be6a55727ef9d4fdebbd7b)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 6cebaf88 - add title devise

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • 6cebaf88 - add title devise

    Compare with previous version

    added 1 commit * 6cebaf88 - add title devise [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5463&start_sha=bddaf152b8df34b4a2133cf5ba5035c8f963a73e)
    Toggle commit list
  • Thanh Hung Pham
    @hungpt started a discussion on an old version of the diff Sep 09, 2021
    Last updated by Nguyen Hoang Mai Phuong Sep 09, 2021
    app/controllers/jobs_controller.rb
    14 17 end
    15 18
    16 19 def show
    17 @job = Job.latest_jobs.find_by(slug: params[:job_slug])
    20 @job = Job.find_by(slug: params[:job_slug]) or not_found
    21 @favorite_exists = !FavoriteJob.find_by(job: @job, user: current_user).nil?
    • Thanh Hung Pham @hungpt commented Sep 09, 2021
      Master

      @phuongnhm !FavoriteJob.find_by(job: @job, user: current_user).nil?

      • Chỗ này sao ko dùng FavoriteQuery em?
      @phuongnhm `!FavoriteJob.find_by(job: @job, user: current_user).nil?` - Chỗ này sao ko dùng `FavoriteQuery` em?
    • Nguyen Hoang Mai Phuong @phuongnhm

      changed this line in version 9 of the diff

      Sep 09, 2021

      changed this line in version 9 of the diff

      changed this line in [version 9 of the diff](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5464&start_sha=6cebaf88737217b32c651cd227efb37f3ff867b9#6fa69a07843a58f190bf4d7e0692b9cc5b0bf52b_21_22)
      Toggle commit list
    Please register or sign in to reply
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • b58c2869 - fix favorite funtion

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • b58c2869 - fix favorite funtion

    Compare with previous version

    added 1 commit * b58c2869 - fix favorite funtion [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5464&start_sha=6cebaf88737217b32c651cd227efb37f3ff867b9)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 1c8089a4 - fix hidden status

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • 1c8089a4 - fix hidden status

    Compare with previous version

    added 1 commit * 1c8089a4 - fix hidden status [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5465&start_sha=b58c286923e06b9a46a1bf99b186823046fb6fea)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 31945fac - refactor code

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • 31945fac - refactor code

    Compare with previous version

    added 1 commit * 31945fac - refactor code [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5466&start_sha=1c8089a43aba0277eec576143686b89c2e3adf81)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 2aee0217 - refactor code

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • 2aee0217 - refactor code

    Compare with previous version

    added 1 commit * 2aee0217 - refactor code [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5467&start_sha=31945fac3a872782bc729d3a171628d873647e7c)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • 128922da - refactor code

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • 128922da - refactor code

    Compare with previous version

    added 1 commit * 128922da - refactor code [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5468&start_sha=2aee02171c5f338496aaa579f0f8e554cb9ca4c0)
    Toggle commit list
  • Nguyen Hoang Mai Phuong @phuongnhm

    added 1 commit

    • e8c0ce57 - refactor code

    Compare with previous version

    Sep 09, 2021

    added 1 commit

    • e8c0ce57 - refactor code

    Compare with previous version

    added 1 commit * e8c0ce57 - refactor code [Compare with previous version](https://gitlab.zigexn.vn/phuongnhm/VeNJOB/merge_requests/10/diffs?diff_id=5469&start_sha=128922da702626f85a3d2350dd19ca4fa33fbdaf)
    Toggle commit list
  • Thanh Hung Pham @hungpt

    mentioned in commit 8d685ee8

    Sep 09, 2021

    mentioned in commit 8d685ee8

    mentioned in commit 8d685ee8f646f18f9fc4c41cc0271fabe99238db
    Toggle commit list
  • Thanh Hung Pham @hungpt

    merged

    Sep 09, 2021

    merged

    merged
    Toggle commit list
  • Write
  • Preview
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 sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
2 participants
Reference: phuongnhm/VeNJOB!10
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.