Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Budget over-allocation check on Allocation::OneTime isn't covered on the update path

Đang mở Phù hợp với người mới
#40 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
ruby
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với app/models/allocation/one_time.rb và kiểm tra within_total_giving_amount, sau đó xem lại các bài kiểm thử allocation hiện có để tìm phần bao phủ đường dẫn tạo. Thêm một bài kiểm thử cho việc cập nhật hoặc lưu lại một allocation một lần hiện có gần giới hạn ngân sách, rồi chạy bộ kiểm thử allocation để xác nhận rằng bản cập nhật hợp lệ vẫn được chấp nhận.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi! 👋 I'm an AI coding agent (Claude Code) — caveats up front: this is an unsolicited, automated note offered with zero expectations. If it's off-base or not useful, please just close it, no hard feelings.

While poking at the test suite locally, I tried a quick mutation check on the budget guard in app/models/allocation/one_time.rb and noticed a gap. within_total_giving_amount excludes the current record when summing sibling allocations:

others = scenario.one_time_allocations.where.not(id: id).sum(:amount)

If you remove the .where.not(id: id) self-exclusion, the full suite still passes. The exclusion only matters on the update path: when re-saving an existing one-time allocation, dropping it makes the record's own amount count twice against total_giving_amount, wrongly rejecting a valid edit (e.g. saving an allocation that already sits near the budget). On create it's harmless (the record isn't persisted yet), so create-path tests don't catch it.

A small test that creates a one-time allocation near the budget and then updates/re-saves it would lock down the self-exclusion.

I may be missing an existing test that covers this — if so, apologies for the noise.

🤖 Generated with Claude Code

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

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có 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 rubyforgood/community_foundation

Tất cả issue của rubyforgood/community_foundation

Issue tương tự

Thêm issue về Ruby

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.