# File lib/kwala/project_builder_utils.rb, line 108 def ProjectBuilderUtils.calc_score(context, action_instances) scores = action_instances.map { |a| a.score } scores.compact! # If action doesn't calculate score, just default to 1 for now if !scores.empty? total = scores.inject(0) { |s,v| s + v } # puts "Total : #{total} SIZE: #{scores.size}" score = ((total / (scores.size * 10).to_f) * 10).ceil img_num = ProjectBuilderUtils.image_for_score(score) # puts "!!!!!!!!!!!!!!!!!! SCORE : #{score} IMG #{img_num} !!!!!!!!!!!" else img_num = 1 end # Mascot Driven Development! context.amrita_data[:mdd] = Amrita.a(:src => "mdd/#{img_num}.png") end