module OpenProject::ServicePacks::Patches::EnumerationPatch::InstanceMethods

Public Instance Methods

update_sp_rates() click to toggle source

Activities are always created and updated as a new Enumeration (see EnumerationsController#create, update and line 117 - 123) so #TEA patching doesn't work.

# File lib/open_project/service_packs/patches/enumeration_patch.rb, line 13
    def update_sp_rates
 if type == "TimeEntryActivity" && shared?
         ServicePack.availables.each do |service_pack|
         # service_pack.mapping_rates << self # WRONG: this is NOT a plain Ruby collection!
   # trying to give a sensible default value
                 service_pack.mapping_rates.create!(units_per_hour: 0, activity_id: self.id)
         end
         end
end