mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Relate all issues created from the same estimate, across batches
- New issues from the estimate preview are now related to each other and to every issue created earlier from the same estimate; older batches that weren't related to each other are linked too - Pairs that already have any relation are skipped - New rake task redmine_qbo_calendar:relate_estimate_issues relates issues created before this change (safe to re-run) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
3 files changed
+62
-15
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#The MIT License (MIT)
|
||||
#
|
||||
#Copyright (c) 2026 rick barrette
|
||||
#
|
||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
#
|
||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
namespace :redmine_qbo_calendar do
|
||||
desc 'Relate all issues created from the same QBO estimate to each other (one-time catch-up; safe to re-run)'
|
||||
task relate_estimate_issues: :environment do
|
||||
total = 0
|
||||
estimates = AppointmentEstimateIssue.distinct.pluck(:estimate_id)
|
||||
|
||||
estimates.each do |estimate_id|
|
||||
issues = AppointmentEstimateIssue.where(estimate_id: estimate_id).includes(:issue).filter_map(&:issue)
|
||||
total += RedmineQboCalendar::EstimateIssueBuilder.relate_all(issues)
|
||||
end
|
||||
|
||||
puts "Checked #{estimates.size} estimate(s), created #{total} relation(s)."
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user