generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cms): change state of a group of cases from closed to resolved
- Loading branch information
1 parent
a6a9dcc
commit d557dec
Showing
2 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
db/migrate/20240426130505_change_state_for_group_of_cases.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
class ChangeStateForGroupOfCases < ActiveRecord::Migration[7.1] | ||
def up | ||
if ENV["APPLICATION_URL"] == "https://www.get-help-buying-for-schools.service.gov.uk" | ||
kase_refs = %w[003112 | ||
003142 | ||
003451 | ||
002026 | ||
002824 | ||
002889 | ||
002893 | ||
002908 | ||
002909 | ||
002914 | ||
002919 | ||
002921 | ||
002934 | ||
002935 | ||
002942 | ||
002947 | ||
002955 | ||
002969 | ||
002977 | ||
002989 | ||
003001 | ||
003005 | ||
003006 | ||
003014 | ||
003015 | ||
003019 | ||
003026 | ||
003028 | ||
003040 | ||
003042 | ||
003045 | ||
003050 | ||
003057 | ||
003065 | ||
003066 | ||
003068 | ||
003070 | ||
003072 | ||
003074 | ||
003106 | ||
003107 | ||
003113 | ||
003119 | ||
003135 | ||
003141 | ||
003143 | ||
003182 | ||
003223 | ||
002875 | ||
002951 | ||
002979 | ||
002980 | ||
002986 | ||
002924 | ||
002435 | ||
002469 | ||
002475 | ||
002528 | ||
002326] | ||
kase_refs.each do |ref| | ||
kase = Support::Case.find_by(ref:) | ||
next if kase.blank? || kase.resolved? | ||
|
||
kase.update!(state: :resolved, action_required: false) | ||
Support::Interaction.state_change.create!( | ||
body: "From closed to resolved by support team on #{Time.zone.now.to_formatted_s(:short)}", | ||
case_id: kase.id, | ||
) | ||
Support::RecordAction.new(case_id: kase.id, action: "change_state", data: { old_state: :closed, new_state: :resolved }).call | ||
end | ||
end | ||
end | ||
|
||
def down; end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters