Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
V
ven-job
  • 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
  • Trịnh Hoàng Phúc
  • ven-job
  • Merge Requests
  • !21

Merged
Opened May 18, 2020 by Trịnh Hoàng Phúc@phucth 
  • Report abuse
Report abuse

Fix review 18/05/2020

×

Check out, review, and merge locally

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

git fetch origin
git checkout -b feature/social_authenticate origin/feature/social_authenticate

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 feature/social_authenticate

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 7
  • Commits 7
  • Pipelines 7
  • Changes 46
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • cb35c893 - Inprogress fix review 18/05/2020

    Compare with previous version

    May 18, 2020

    added 1 commit

    • cb35c893 - Inprogress fix review 18/05/2020

    Compare with previous version

    added 1 commit * cb35c893 - Inprogress fix review 18/05/2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4818&start_sha=f7159414f1b68d4a797f0b136b5188974d6596ba)
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • 475139e9 - Clean code

    Compare with previous version

    May 18, 2020

    added 1 commit

    • 475139e9 - Clean code

    Compare with previous version

    added 1 commit * 475139e9 - Clean code [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4819&start_sha=cb35c893aaee448beac8a3d8a0935e9f01175c56)
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • b07006ff - Add table History, fix review 19/05/2020

    Compare with previous version

    May 19, 2020

    added 1 commit

    • b07006ff - Add table History, fix review 19/05/2020

    Compare with previous version

    added 1 commit * b07006ff - Add table History, fix review 19/05/2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4820&start_sha=475139e9c5a67afdd7c287a32ef09cf112d80339)
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • f8287fd5 - Add concerns for cookies_history

    Compare with previous version

    May 19, 2020

    added 1 commit

    • f8287fd5 - Add concerns for cookies_history

    Compare with previous version

    added 1 commit * f8287fd5 - Add concerns for cookies_history [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4821&start_sha=b07006ff2a511e1fdbe57ed4cac4ad01f320b5e7)
    Toggle commit list
  • phuctmZigexn
    @phuctm started a discussion on an old version of the diff May 21, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/models/history.rb 0 → 100644
    1 class History < ApplicationRecord
    2 belongs_to :user
    3 belongs_to :job
    4
    5 def self.create_history(job_id, user_id)
    • phuctmZigexn @phuctm commented May 21, 2020
      1. Không cần phải return vì không xử dụng lại giá trị trả về
      2. Nên có cột created_at, updated_at
      3. Nếu history tồn tại thì update cột updated_at, nếu chưa có thì tạo history mới.
      4. Vì cột job_id và user_id được query thường xuyên nên cần đánh index cho 2 cột này để tăng tốc độ query.

      Tham khảo: https://devhints.io/rails-migrations

      Edited May 22, 2020
      1. Không cần phải return vì không xử dụng lại giá trị trả về 2. Nên có cột created_at, updated_at 3. Nếu history tồn tại thì update cột updated_at, nếu chưa có thì tạo history mới. 4. Vì cột job_id và user_id được query thường xuyên nên cần đánh index cho 2 cột này để tăng tốc độ query. Tham khảo: https://devhints.io/rails-migrations
    • Trịnh Hoàng Phúc @phucth

      changed this line in version 6 of the diff

      May 22, 2020

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b#fe344c0863710402625ffa768b4c144a92ef1a22_5_4)
      Toggle commit list
    Please register or sign in to reply
  • phuctmZigexn
    @phuctm started a discussion on an old version of the diff May 21, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/controllers/concerns/cookies_history.rb 0 → 100644
    1 module CookiesHistory
    2 def set_job_histories
    3 if cookies[:job_ids_history].nil?
    • phuctmZigexn @phuctm commented May 21, 2020
      arr_job_ids = cookies[:job_ids_history].to_s.split(",")
      
          unless arr_job_ids.include? (@job.id.to_s)
            arr_job_ids.shift if arr_job_ids.count == 10
            arr_job_ids << @job.id.to_s
          end
      
          cookies[:job_ids_history] = { value: arr_job_ids.join(","), expires: Time.now + 3600 }
      Edited May 22, 2020
      ``` arr_job_ids = cookies[:job_ids_history].to_s.split(",") unless arr_job_ids.include? (@job.id.to_s) arr_job_ids.shift if arr_job_ids.count == 10 arr_job_ids << @job.id.to_s end cookies[:job_ids_history] = { value: arr_job_ids.join(","), expires: Time.now + 3600 } ```
    • Trịnh Hoàng Phúc @phucth

      changed this line in version 6 of the diff

      May 22, 2020

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b#1e33c5a669406ff63bb1208cb8e1653f3fcfb50b_3_3)
      Toggle commit list
    Please register or sign in to reply
  • phuctmZigexn
    @phuctm started a discussion on an old version of the diff May 22, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/controllers/history_controller.rb
    1 1 class HistoryController < ApplicationController
    2 2 def index
    3 if cookies[:job_ids_history].nil?
    4 redirect_to "/jobs"
    3 if user_signed_in?
    4 @jobs_history = History.includes(:job, :user).where("user_id = #{current_user.id}")
    • phuctmZigexn @phuctm commented May 22, 2020

      @jobs_history = History.includes(:job, :user).where(user_id: current_user.id)

      Edited May 22, 2020
      @jobs_history = History.includes(:job, :user).where(user_id: current_user.id)
    • Trịnh Hoàng Phúc @phucth

      changed this line in version 6 of the diff

      May 22, 2020

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b#a92ef6a95aba233b658470993c01dfe3eb19a9fe_4_4)
      Toggle commit list
    Please register or sign in to reply
  • phuctmZigexn
    @phuctm started a discussion on an old version of the diff May 22, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/controllers/history_controller.rb
    1 1 class HistoryController < ApplicationController
    2 2 def index
    3 if cookies[:job_ids_history].nil?
    4 redirect_to "/jobs"
    3 if user_signed_in?
    4 @jobs_history = History.includes(:job, :user).where("user_id = #{current_user.id}")
    5 5 else
    6 6 arr_job_ids = cookies[:job_ids_history].split(",")
    • phuctmZigexn @phuctm commented May 22, 2020

      arr_job_ids => không dùng

      Edited May 22, 2020
      `arr_job_ids` => không dùng
    • Trịnh Hoàng Phúc @phucth

      changed this line in version 6 of the diff

      May 22, 2020

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b#a92ef6a95aba233b658470993c01dfe3eb19a9fe_6_6)
      Toggle commit list
    Please register or sign in to reply
  • phuctmZigexn
    @phuctm started a discussion on an old version of the diff May 22, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/controllers/history_controller.rb
    1 1 class HistoryController < ApplicationController
    2 2 def index
    3 if cookies[:job_ids_history].nil?
    4 redirect_to "/jobs"
    3 if user_signed_in?
    4 @jobs_history = History.includes(:job, :user).where("user_id = #{current_user.id}")
    5 5 else
    6 6 arr_job_ids = cookies[:job_ids_history].split(",")
    7 7 job_ids = cookies[:job_ids_history].split(",")
    8 8 @jobs_history = Job.where("id IN (?)", job_ids).order("id DESC")
    • phuctmZigexn @phuctm commented May 22, 2020

      @jobs_history = Job.where(id: job_ids)

      hình như default của where là nó sẽ sort theo ID rồi

      Edited May 22, 2020
      `@jobs_history = Job.where(id: job_ids)` hình như default của where là nó sẽ sort theo ID rồi
    • phuctmZigexn @phuctm commented May 22, 2020

      chuyển qua dùng find => Job.find(job_ids)

      vì mình phải show những job theo đúng thứ tự user vào xem. khi dùng find và truyền vào là 1 array ids thì kết quả trả về sẽ giống với thứ tự id truyền vào. còn dùng where thì sẽ auto sort lại theo id tăng dần.

      tham khảo: https://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find

      Edited May 22, 2020
      chuyển qua dùng `find` => `Job.find(job_ids)` vì mình phải show những job theo đúng thứ tự user vào xem. khi dùng find và truyền vào là 1 array ids thì kết quả trả về sẽ giống với thứ tự id truyền vào. còn dùng `where` thì sẽ auto sort lại theo id tăng dần. tham khảo: https://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-find
    • Trịnh Hoàng Phúc @phucth

      changed this line in version 6 of the diff

      May 22, 2020

      changed this line in version 6 of the diff

      changed this line in [version 6 of the diff](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b#a92ef6a95aba233b658470993c01dfe3eb19a9fe_8_7)
      Toggle commit list
    Please register or sign in to reply
  • phuctmZigexn
    @phuctm started a discussion on the diff May 22, 2020
    Resolved by Trịnh Hoàng Phúc May 22, 2020
    app/models/job.rb
    1 1 class Job < ApplicationRecord
    2 2 scope :by_cities, -> (city_id) {includes(:cities).where("cities.id = ?", city_id).references(:cities)}
    3 3 scope :by_industries, -> (industry_id) {includes(:industries).where("industries.id = ?", industry_id).references(:industries)}
    4 scope :by_companies, -> (company_id) {where("company_id = #{company_id}")}
    4 scope :by_companies, -> (company_id) {where("company_id = ?", company_id)}
    • phuctmZigexn @phuctm commented May 22, 2020

      scope :by_companies, -> (company_id) {where(company_id: company_id)}

      Edited May 22, 2020
      `scope :by_companies, -> (company_id) {where(company_id: company_id)}`
    Please register or sign in to reply
  • Trịnh Hoàng Phúc @phucth

    resolved all discussions

    May 22, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    resolved all discussions

    May 22, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    resolved all discussions

    May 22, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    resolved all discussions

    May 22, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    resolved all discussions

    May 22, 2020

    resolved all discussions

    resolved all discussions
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • ee707e8a - Fix review 22/05/2020

    Compare with previous version

    May 22, 2020

    added 1 commit

    • ee707e8a - Fix review 22/05/2020

    Compare with previous version

    added 1 commit * ee707e8a - Fix review 22&#x2F;05&#x2F;2020 [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4822&start_sha=f8287fd5d37510b43dea7b4965f2d57447d1506b)
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    added 1 commit

    • a95865dc - clean code

    Compare with previous version

    May 22, 2020

    added 1 commit

    • a95865dc - clean code

    Compare with previous version

    added 1 commit * a95865dc - clean code [Compare with previous version](https://gitlab.zigexn.vn/phucth/ven-job/merge_requests/21/diffs?diff_id=4823&start_sha=ee707e8aee460937e9c115dbd3713f0aa249d07e)
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    mentioned in commit c88e02de

    May 22, 2020

    mentioned in commit c88e02de

    mentioned in commit c88e02de3fdf765012feeeaa044557b987d84d52
    Toggle commit list
  • Trịnh Hoàng Phúc @phucth

    merged

    May 22, 2020

    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: phucth/ven-job!21
×

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.