Commit 74c15a6a2ce81f829833f59b92f87ca34961dfd2

Authored by Hugo Melo
1 parent 2dd932d8

Avoid error on badge migration

db/migrate/20151003000212_move_badge_threshold_to_action_key.rb
... ... @@ -6,6 +6,7 @@ class MoveBadgeThresholdToActionKey < ActiveRecord::Migration
6 6 GamificationPlugin::Badge.all.each do |badge|
7 7 next if Merit::BadgeRules::AVAILABLE_RULES[badge.name.to_sym].nil?
8 8 Merit::BadgeRules::AVAILABLE_RULES[badge.name.to_sym].each do |setting|
  9 + badge.custom_fields = {} unless badge.custom_fields.is_a? Hash
9 10 badge.custom_fields[setting[:action]] = {threshold: badge.custom_fields[:threshold]} unless badge.custom_fields[:threshold].nil?
10 11 badge.save
11 12 end
... ...