fix contributions for pet states and items

dependent contributables would only count as contributed if their parent
was being contributed for the first time, too. the trick was to delay
actually *assigning* them to their parents until the very, very end
This commit is contained in:
Emi Matchu 2010-11-15 17:56:16 -05:00
parent 9fc24a2eab
commit 8e6a34b69c
3 changed files with 1 additions and 3 deletions

View file

@ -49,7 +49,6 @@ class Pet < ActiveRecord::Base
def contributables
contributables = [pet_type, @pet_state]
items.each do |item|
item.handle_assets!
contributables << item
contributables += item.pending_swf_assets
end

View file

@ -97,7 +97,6 @@ class PetType < ActiveRecord::Base
def add_pet_state_from_biology!(biology)
pet_state = PetState.from_pet_type_and_biology_info(self, biology)
self.pet_states << pet_state
pet_state
end

View file

@ -17,10 +17,10 @@ class User < ActiveRecord::Base
new_points += contribution.point_value
end
end
self.contributions += new_contributions
self.points += new_points
Pet.transaction do
pet.save!
self.contributions += new_contributions
save!
end
new_points