Adding support for keeping points synked if you have a custom field named "Points" on the issues.

pull/6827/head
Joakim Kolsjö 15 years ago
parent f791df0f32
commit de4349cad8
  1. 4
      README.rdoc
  2. 19
      app/models/item.rb

@ -12,6 +12,10 @@ A scrum/agile tool. Useful for product planning, sprint planning, and daily stan
You will need to enable the Backlogs module per project via Settings > Modules. Also, make check that the right roles have permission to use the module by going to Administration > Roles and Permissions > Permissions Report.
= Points sync
If you have a custom field called "Points" on the issues, that value will be kept in sync with the corresponding Backlog issue points.
= Chart Data Generator
You may schedule a cron job to run the rake task named <tt>redmine:backlogs_plugin:generate_chart_data</tt>. I recommend you run it a few minutes after midnight to ensure that your backlogs have data everyday even when no user views the charts.

@ -4,6 +4,8 @@ class Item < ActiveRecord::Base
belongs_to :backlog
acts_as_list :scope => 'items.backlog_id=#{backlog_id} AND items.parent_id=#{parent_id}'
acts_as_tree :order => "items.position ASC, created_at ASC"
after_save :update_issue_points
def append_comment(user, comment)
journal = issue.init_journal(User.current, @notes)
@ -99,14 +101,19 @@ class Item < ActiveRecord::Base
find_by_issue_id(issue.id).destroy
end
def update_issue_points
Item.custom_points(issue).update_attribute(:value, points) if Item.custom_points(issue)
end
def self.update_from_issue(issue)
backlog = Backlog.find_by_version_id(issue.fixed_version_id)
item = find_by_issue_id(issue.id) || Item.new()
item.issue_id = issue.id
item.backlog_id = (backlog.nil? ? 0 : backlog.id)
item.save
end
item.points = custom_points(issue).value if custom_points(issue)
item.save
end
def determine_new_position(params)
if params[:prev]=="" || params[:prev].nil?
1
@ -120,4 +127,10 @@ class Item < ActiveRecord::Base
insert_at determine_new_position(params)
end
private
def self.custom_points(issue)
issue.custom_values.to_a.find { |value| value.custom_field.name == "Points" }
end
end

Loading…
Cancel
Save