Created
December 11, 2018 23:47
-
-
Save austindoeswork/e7bf50e7753685ea02e6e9c3bdd276d6 to your computer and use it in GitHub Desktop.
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
calls = Call.where(company_id: 62) | |
# RUN ONCE! | |
calls.each do |call| | |
call.occurred_at = call.occurred_at + 3.hour | |
mute_offsets = call.pp_data["mute_offsets"] | |
if !mute_offsets.nil? | |
new_offsets = [] | |
mute_offsets.each do |mute_offset| | |
if mute_offset | |
offset = mute_offset.map{|o| o - 3.hour > 0 ? o - 3.hour : o} | |
new_offsets << offset | |
end | |
end | |
call.pp_data["mute_offsets"] = new_offsets | |
end | |
call.save | |
end | |
# / RUN ONCE | |
bad_calls = [] | |
calls.each do |call| | |
pc = PendingCall.search(call.filename.split[0], call.occurred_at) | |
if pc.nil? | |
puts "#{call.id} has no pending call" | |
bad_calls << call | |
end | |
end | |
bad_calls.each do |call| | |
call.update_status(950, nil, "AustinConsole") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment