Skip to content

Commit

Permalink
fix(cms): change state of a group of cases from closed to resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
serenaabbott11 committed May 7, 2024
1 parent a6a9dcc commit d557dec
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
78 changes: 78 additions & 0 deletions db/migrate/20240426130505_change_state_for_group_of_cases.rb
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
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_04_15_143752) do
ActiveRecord::Schema[7.1].define(version: 2024_04_26_130505) do
create_sequence "evaluation_refs"
create_sequence "framework_refs"

Expand Down

0 comments on commit d557dec

Please sign in to comment.