Add counter cache to projects for open and closed conversations

Đang mở
#1,313 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

@snewcomer đang làm issue này rồi.

Từ ngày 26/12/2017.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Time: 2 hours

Problem

When a conversation record is created/updated, we need to update the open_conversations_count and closed _conversations_count counter cache columns on the projects table.

  • Add project_id to Conversation
    • change in Ember app to send the project_id up to the app
    • change in API
    • migrate data

We'll need to update the counts based on the following logic:

  • on insert
    • inc: [open_conversations_count: 1]
  • on update
    • status "open" => "closed"
      • inc: [closed_conversations_count: 1, open_conversations_count: -1]
  • on update
    • status "closed" => "open"
      • inc: [closed_conversations_count: -1, open_conversations_count: 1]

We'll add prepare_changes to increment one and decrement the other. See this example in Ecto

A useful post on this, as well: https://medium.com/@kaisersly/prepare-changes-and-counter-cache-abd93b8a20a

Ngôn ngữ chính
Elixir
Star
234
Fork
82
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của code-corps/code-corps-api

Tất cả issue của code-corps/code-corps-api

Issue tương tự

Thêm issue về Elixir

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.