OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/backlogs_version_patch.rb

37 lines
949 B

require_dependency 'version'
module Backlogs
module VersionPatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
has_many :version_settings, :dependent => :destroy
accepts_nested_attributes_for :version_settings
end
end
module ClassMethods
end
module InstanceMethods
def touch_burndown
BurndownDay.find(:all,
:joins => :version,
:conditions => ['burndown_days.version_id = ? and (burndown_days.created_at >= ? or burndown_days.created_at >= versions.effective_date)', self.id, Date.today]
).each {|bdd|
BurndownDay.destroy(bdd.id)
}
end
def burndown
return Sprint.find_by_id(self.id).burndown
end
end
end
end
Version.send(:include, Backlogs::VersionPatch) unless Version.included_modules.include? Backlogs::VersionPatch