Merge pull request #13 from finnlabs/feature/rails3_fix_burndown_charts

Feature/rails3 fix burndown charts
pull/6827/head
Christian Rijke 12 years ago
commit f431fab314
  1. 12
      app/helpers/burndown_charts_helper.rb
  2. 2
      app/helpers/rb_common_helper.rb
  3. 4
      app/models/burndown.rb
  4. 8
      app/views/rb_burndown_charts/_burndown.html.erb
  5. 6
      lib/open_project/backlogs/burndown/series_raw_data.rb

@ -10,16 +10,18 @@ module BurndownChartsHelper
labels << "[#{(mvalue) * 25}, '<span class=\"axislabel\">#{l('backlogs.hours')}/<br>#{l('backlogs.points')}</span>']"
labels.join(', ')
result = labels.join(', ')
result.html_safe
end
def xaxis_labels(burndown)
burndown.days.enum_for(:each_with_index).collect{|d,i| "[#{i+1}, '#{escape_javascript(::I18n.t('date.abbr_day_names')[d.wday % 7])}']"}.join(',') +
", [#{burndown.days.length + 1}, '<span class=\"axislabel\">#{I18n.t('backlogs.date')}</span>']"
burndown.days.enum_for(:each_with_index).collect{|d,i| "[#{i+1}, '#{escape_javascript(::I18n.t('date.abbr_day_names')[d.wday % 7])}']"}.join(',').html_safe +
", [#{burndown.days.length + 1}, '<span class=\"axislabel\">#{I18n.t('backlogs.date')}</span>']".html_safe
end
def dataseries(burndown)
burndown.series.collect{|s| "#{s.first.to_s}: {label: '#{l('backlogs.' + s.first.to_s)}', data: [#{s.last.enum_for(:each_with_index).collect{|s, i| "[#{i+1}, #{s}] "}.join(', ')}]} "}
burndown.series.collect{|s| "#{s.first.to_s}: {label: '#{l('backlogs.' + s.first.to_s)}', data: [#{s.last.enum_for(:each_with_index).collect{|s, i| "[#{i+1}, #{s}] "}.join(', ')}]} "}.join(', ').html_safe
end
def burndown_series_checkboxes(burndown)
@ -27,6 +29,6 @@ module BurndownChartsHelper
burndown.series(:all).collect{|s| s.first.to_s }.sort.each do |series|
boxes += "<input class=\"series_enabled\" type=\"checkbox\" id=\"#{series}\" name=\"#{series}\" value=\"#{series}\" checked>#{l('backlogs.' + series.to_s)}<br/>"
end
boxes
boxes.html_safe
end
end

@ -172,7 +172,7 @@ module RbCommonHelper
var burndown = RB.Factory.initialize(RB.Burndown, jQuery('.show_burndown_chart'));
burndown.setSprintId(#{sprint.id});
});"
ret
ret.html_safe
end
private

@ -8,7 +8,7 @@ class Burndown
days = make_date_series sprint
series_data = Backlogs::Burndown::SeriesRawData.new(project,
series_data = OpenProject::Backlogs::Burndown::SeriesRawData.new(project,
sprint,
:hours => ["remaining_hours"],
:points => ["story_points"])
@ -69,7 +69,7 @@ class Burndown
def make_series(name, units, data)
@available_series ||= {}
s = Backlogs::Burndown::Series.new(data, name, units)
s = OpenProject::Backlogs::Burndown::Series.new(data, name, units)
@available_series[name] = s
instance_variable_set("@#{name}", s)
end

@ -1,12 +1,12 @@
<%= stylesheet_link_tag 'jqplot.css', :plugin => 'chiliproject_backlogs' %>
<%= stylesheet_link_tag 'backlogs/jqplot.css', :plugin => 'chiliproject_backlogs' %>
<!--[if IE]><%= javascript_include_tag 'lib/jquery.flot/excanvas.js', :plugin => 'chiliproject_backlogs' %><![endif]-->
<%= javascript_include_tag 'lib/jquery.flot/jquery.flot.js', :plugin => 'chiliproject_backlogs' %>
<!--[if IE]><%= javascript_include_tag 'backlogs/lib/jquery.flot/excanvas.js', :plugin => 'chiliproject_backlogs' %><![endif]-->
<%= javascript_include_tag 'backlogs/lib/jquery.flot/jquery.flot.js', :plugin => 'chiliproject_backlogs' %>
<script type="text/javascript" language="javascript">
jQuery(function ($) {
var Burndown = {
datasets: { <%= dataseries(burndown).join(', ') %> },
datasets: { <%= dataseries(burndown) %> },
previousPoint: null,
setDatasetColor: function () {

@ -89,11 +89,11 @@ module OpenProject::Backlogs::Burndown
end
def find_interesting_stories
fixed_version_query = "(issues.fixed_version_id = ? OR journals.changes LIKE '%fixed_version_id: - ? - [0-9]+%' OR journals.changes LIKE '%fixed_version_id: - [0-9]+ - ?%')"
project_id_query = "(issues.project_id = ? OR journals.changes LIKE '%project_id: - ? - [0-9]+%' OR journals.changes LIKE '%project_id: - [0-9]+ - ?%')"
fixed_version_query = "(issues.fixed_version_id = ? OR journals.changed_data LIKE '%fixed_version_id: - ? - [0-9]+%' OR journals.changed_data LIKE '%fixed_version_id: - [0-9]+ - ?%')"
project_id_query = "(issues.project_id = ? OR journals.changed_data LIKE '%project_id: - ? - [0-9]+%' OR journals.changed_data LIKE '%project_id: - [0-9]+ - ?%')"
trackers_string = "(#{collected_trackers.map{|i| "(#{i})"}.join("|")})"
tracker_id_query = "(issues.tracker_id in (?) OR journals.changes LIKE '%tracker_id: - #{trackers_string} - [0-9]+%' OR journals.changes LIKE '%tracker_id: - [0-9]+ - #{trackers_string}%')"
tracker_id_query = "(issues.tracker_id in (?) OR journals.changed_data LIKE '%tracker_id: - #{trackers_string} - [0-9]+%' OR journals.changed_data LIKE '%tracker_id: - [0-9]+ - #{trackers_string}%')"
stories = Issue.all(:include => :journals,
:conditions => ["#{ fixed_version_query }" +

Loading…
Cancel
Save