Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

type reset optimization/fix

  • Loading branch information...
commit ff3873de8a0ef542d5d17f9993cef46b06f72a52 1 parent c0bd9ce
@ethn ethn authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 card/mod/01_core/set/all/type.rb
View
10 card/mod/01_core/set/all/type.rb
@@ -28,7 +28,7 @@ def type= type_name
def get_type_id args={}
return if args[:type_id] # type_id was set explicitly. no need to set again.
-
+
type_id = case
when args[:type_code]
if code=args[:type_code]
@@ -60,11 +60,11 @@ def get_type_id args={}
end
end
-event :validate_type, :before=>:approve, :changed=>:type_id do
+event :validate_type, :before=>:approve, :changed=>:type_id do
if !type_name
errors.add :type, "No such type"
end
-
+
if rt = structure and rt.assigns_type? and type_id!=rt.type_id
errors.add :type, "can't be changed because #{name} is hard templated to #{rt.type_name}"
end
@@ -72,7 +72,7 @@ def get_type_id args={}
event :reset_type_specific_fields, :after=>:store do
Auth.as_bot do
- Card.search :left=>{ :left=>type_name }, :right=>{:codename=>'type_plus_right'} do |set_card|
+ Card.search :left=>{ :left_id=>type_id }, :right=>{:codename=>'type_plus_right'} do |set_card|
set_card.reset_set_patterns
end
end
@@ -82,4 +82,4 @@ def get_type_id args={}
# Card["#{lef}"]
# set_card.reset_set_patterns
# end
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.