if_statement --> _if migration

pull/305/head
Rick Carlino 2016-12-29 10:16:15 -06:00
parent 21b8db892e
commit e28b4430bc
5 changed files with 19 additions and 6 deletions

View File

@ -1 +1 @@
2.3.2
2.3.3

View File

@ -5,7 +5,7 @@
```
<%=
JSON.pretty_generate(request.params.except(:controller, :action, :format, :id))
JSON.pretty_generate(request.params.except(:controller, :action, :format, :id, :user_id, :device_id))
%>
```
<% end %>

View File

@ -15,7 +15,17 @@ module SequenceMigration
.body
.select { |x| x["kind"] == "if_statement" }
.each do |x|
binding.pry
x["kind"] = "_if"
x["args"] = {
"lhs": x["args"]["lhs"],
"rhs": x["args"]["rhs"],
"op": x["args"]["op"],
"_then": {
"kind": "execute",
"args": { "sub_sequence_id": x["args"]["sub_sequence_id"] }
},
"_else": { "kind": "nothing", "args": {} }
}
end
end
end

View File

@ -37,8 +37,12 @@ class Sequence < ActiveRecord::Base
# Helper used for QAing stuff on staging. Grabs a random sequence from the
# database, runs a migration (does not save) and prints to screen.
def self.spot_check
s = Sequence.order("RANDOM()").first
s = random
puts "Sequence ##{s.id} ========="
puts s.maybe_migrate.body.to_yaml
end
def self.random
Sequence.order("RANDOM()").first
end
end

View File

@ -33,5 +33,4 @@ module ToolSlots
ts.update_attributes!(params) && ts
end
end
end
end