Skip to content

Commit

Permalink
Fixed event data cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmacleod committed Aug 29, 2012
1 parent 3967b45 commit cdfab67
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/models/event.rb
Expand Up @@ -59,6 +59,10 @@ def search_time
next_performance_time
end


# Callbacks
after_save :update_performance_caches

# Class methods
############################################################################

Expand Down Expand Up @@ -314,12 +318,20 @@ def date_string

end


private

# Formats a number into a price with precision 2
def price_format(number)
return "free" if number.to_f==0.to_f
"£%01.2f" % ((Float(number.to_f) * (10 ** 2)).round.to_f / 10 ** 2)
end


def update_performance_caches
performances.each do |p|
p.skip_event_cache_update = true
p.save
end
end

end

0 comments on commit cdfab67

Please sign in to comment.