redmine_charts patch for Redmine0.9.0
Added by Dai Fujihara almost 15 years ago
Hi.
Thank you for a wonderful plugin.
It is very useful and I think that a lot of Redmine users are pleased with Japan.
I tried installation to Redmine 0.9.0.
I will share because there were some a corrected heavens. It would be greatly appreciated if it could help you.
diff -u -r C:\fujihara\before\lib/redmine_charts/conditions_utils.rb C:\fujihara\after\lib/redmine_charts/conditions_utils.rb --- C:\fujihara\before\lib/redmine_charts/conditions_utils.rb Thu Sep 3 03:59:44 2009 +++ C:\fujihara\after\lib/redmine_charts/conditions_utils.rb Sat Jan 30 00:33:06 2010 @@ -35,11 +35,11 @@ ["time_entries.user_id".to_sym, users.to_a.unshift([l(:charts_condition_all), 0])] when "time_entries.issue_id".to_sym then ["time_entries.issue_id".to_sym, nil] - when "time_entries.activity_id".to_sym then ["time_entries.activity_id".to_sym, Enumeration.find_all_by_opt("ACTI").collect { |a| [a.name, a.id] }.unshift([l(:charts_condition_all), 0])] + when "time_entries.activity_id".to_sym then ["time_entries.activity_id".to_sym, Enumeration.find_all_by_type("TimeEntryActivity").collect { |a| [a.name, a.id] }.unshift([l(:charts_condition_all), 0])] when "issues.category_id".to_sym then ["issues.category_id".to_sym, IssueCategory.find_all_by_project_id(project_and_its_children_ids(project_id)).collect { |c| [c.name, c.id] }.unshift([l(:charts_condition_all), 0])] when "issues.fixed_version_id".to_sym then ["issues.fixed_version_id".to_sym, Version.find_all_by_project_id(project_and_its_children_ids(project_id)).collect { |c| [c.name, c.id] }.unshift([l(:charts_condition_all), 0])] when "issues.tracker_id".to_sym then ["issues.tracker_id".to_sym, Tracker.all.collect { |c| [c.name, c.id] }.unshift([l(:charts_condition_all), 0])] - when "issues.priority_id".to_sym then ["issues.priority_id".to_sym, Enumeration.find_all_by_opt("IPRI").collect { |a| [a.name, a.id] }.unshift([l(:charts_condition_all), 0])] + when "issues.priority_id".to_sym then ["issues.priority_id".to_sym, Enumeration.find_all_by_type("IssuePriority").collect { |a| [a.name, a.id] }.unshift([l(:charts_condition_all), 0])] end end end
Thanks. Best Regards.
Dai Fujihara
Replies (14)
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov almost 15 years ago
Also it seems that plugin has error in strings concatenation so instead of creating new string, plugin modifies string from language resource thus creating recursion. (It was also mentioned here: http://github.com/mszczytowski/redmine_charts/issues#issue/19 )
To fix this and similar problems, please modify charts_helper.rb file in the following places:
def show_date_condition(range_steps, range_in, range_offset)
+ res = ""
res << l(:charts_show_last) << " "
also here
def show_pages(page, pages)
if pages > 1
+ res = ""
if page == 1
res << l(:charts_previous)
also please modify file charts_deviation_controller.rb
def get_remaining_hint(logged_ratio, remaining_ratio, done_ratio, logged_hours, remaining_hours, estimated_hours, row = nil)
+ hint =""
if logged_ratio + remaining_ratio > 100 # Issue is delayed.
and here
def get_logged_hint(logged_ratio, remaining_ratio, done_ratio, logged_hours, estimated_hours, row = nil)
+ hint = ""
if logged_ratio > 100 and remaining_ratio == 0 # Issue is finished.
Hope this helps
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov almost 15 years ago
Sorry for the repost, but i realized that you have to change lines with assignment as well, so final patch would look like this
File charts_helper.rb
def show_date_condition(range_steps, range_in, range_offset)
+ res = ""
+ res << l(:charts_show_last) << " "
- res = l(:charts_show_last) << " "
res << text_field_tag(:range_steps, range_steps, :size => 4)
also here
def show_pages(page, pages)
+ res = ""
if pages > 1
if page == 1
+ res << l(:charts_previous)
- res = l(:charts_previous)
else
+ res = link_to_function(l(:charts_previous), :onclick => 'charts_previous();')
- res = link_to_function(l(:charts_previous), :onclick => 'charts_previous();')
end
res << ' - '
file charts_deviation_controller.rb
def get_remaining_hint(logged_ratio, remaining_ratio, done_ratio, logged_hours, remaining_hours, estimated_hours, row = nil)
+ hint= ""
if logged_ratio + remaining_ratio > 100 # Issue is delayed.
+ hint << l(:charts_deviation_hint_remaining_over_estimation, { :remaining_hours => RedmineCharts::Utils.round(remaining_hours), :hours_over_estimation => RedmineCharts::Utils.round(logged_hours.to_f + remaining_hours.to_f - estimated_hours.to_f), :over_estimation => (logged_ratio.to_f + remaining_ratio.to_f - 100).round })
- hint = l(:charts_deviation_hint_remaining_over_estimation, { :remaining_hours => RedmineCharts::Utils.round(remaining_hours), :hours_over_estimation => RedmineCharts::Utils.round(logged_hours.to_f + remaining_hours.to_f - estimated_hours.to_f), :over_estimation => (logged_ratio.to_f + remaining_ratio.to_f - 100).round })
else
+ hint << l(:charts_deviation_hint_remaining, { :remaining_hours => RedmineCharts::Utils.round(remaining_hours) })
- hint = l(:charts_deviation_hint_remaining, { :remaining_hours => RedmineCharts::Utils.round(remaining_hours) })
end
and here:
def get_logged_hint(logged_ratio, remaining_ratio, done_ratio, logged_hours, estimated_hours, row = nil)
+ hint =""
if logged_ratio > 100 and remaining_ratio == 0 # Issue is finished.
+ hint << l(:charts_deviation_hint_logged_over_estimation, { :logged_hours => RedmineCharts::Utils.round(logged_hours), :hours_over_estimation => RedmineCharts::Utils.round(logged_hours.to_f - estimated_hours.to_f), :over_estimation => (logged_ratio.to_f - 100).round })
- hint = l(:charts_deviation_hint_logged_over_estimation, { :logged_hours => RedmineCharts::Utils.round(logged_hours), :hours_over_estimation => RedmineCharts::Utils.round(logged_hours.to_f - estimated_hours.to_f), :over_estimation => (logged_ratio.to_f - 100).round })
else
+ hint << l(:charts_deviation_hint_logged, { :logged_hours => RedmineCharts::Utils.round(logged_hours) })
- hint = l(:charts_deviation_hint_logged, { :logged_hours => RedmineCharts::Utils.round(logged_hours) })
end
Hope this helps
RE: redmine_charts patch for Redmine0.9.0 - Added by Fabio Leitao almost 15 years ago
Thanks a lot, so far those patches have solved the Error 500 and Error 404 issues in my 0.9.2 build I had since I have tried this plugin, therefore the charts_ratio and charts_deviation seem to work perfectly now.
But the charts_burnout and charts_timeline do not plot a thing yet; I have read about in some other topic about the "dotted line" no longer being compatible and that it should be replaced by "line" (or vice versa), but I am not sure where I have read, or where to change it to give it a try. I am not a rails programmer.
Other peculiar behavior for my setup has been that both at the chart_burnout and chart_timeline pages keep multiplying amount of days/weeks/months options, repeating the code in the screen somehow (screen captured), and in a somewhat similar miss-hap, so does the "next page >>" in the bottom of the chart_deviation (also captured)
I am using the redmine site in pt-Br,but this alone should not have such impact in the plugin up to my knowledge.
I can help you test new patches or get log files back if you need.
burndown.png (53.5 KB) burndown.png | |||
ratio.png (59.2 KB) ratio.png | |||
timeline.png (54.4 KB) timeline.png | |||
deviation.png (54.9 KB) deviation.png |
RE: redmine_charts patch for Redmine0.9.0 - Added by Fabio Leitao almost 15 years ago
By the way, I have looked for Dot in the code with fgrep and found it at 14th line of the file lib/redmine_charts/line_data_converter.rb: line = OpenFlashChart::LineDot.new
I have replaced this with ::Line.new
Now it plots as solid lines, which is cute
I had no influence over the other issue, obviously, but getting closer ;D
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov almost 15 years ago
Other peculiar behavior for my setup has been that both at the chart_burnout and chart_timeline pages keep multiplying amount of days/weeks/months options, repeating the code in the screen somehow (screen captured), and in a somewhat similar miss-hap, so does the "next page >>" in the bottom of the chart_deviation (also captured)
Regarding multiplying pages - my fault - i have mistyped - in file charts_helper.rb please use << operator instead of = in function show_pages, so the line would look like this:
else
+ res << link_to_function(l(:charts_previous), :onclick => 'charts_previous();')
- res = link_to_function(l(:charts_previous), :onclick => 'charts_previous();')
end
I have attached whole redmine_chars folder from my redmine setup - you may want to replace yours and see if it helps
RE: redmine_charts patch for Redmine0.9.0 - Added by Fabio Leitao almost 15 years ago
I have opened from your pack, and reproduced the change exactly as is on my file
Indeed it has solved the multiple "next page >>" issue, thanks
Is there a similar fix the the multiple "date range" in the timeline and burnout?
The graph is plot perfectly, it works, but it is rather odd, and I cannot change the amount of days/weeks/months due to that... (captured screen, upon each refresh, a new "before after 10 weeks" line gets on the right side of the page)
timeline2.png (66.5 KB) timeline2.png | miss-hap of time range selector | ||
burnout2.png (69.7 KB) burnout2.png | miss-hap of time range selector |
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov almost 15 years ago
You have to change one line with = sign to the two following lines in the start of the function show_date_condition in the same file and everything will work as a charm:
def show_date_condition(range_steps, range_in, range_offset)
+ res = ""
+ res << l(:charts_show_last) << " "
- res = l(:charts_show_last) << " "
res << text_field_tag(:range_steps, range_steps, :size => 4)
or just copy these lines from my file
RE: redmine_charts patch for Redmine0.9.0 - Added by Fabio Leitao almost 15 years ago
Hey, after this rails crash test, I think I have found it
My copy of the app/helpers/charts_helper.rb had an extra line in the def show_date_condition
Basicaly:
def show_date_condition(range_steps, range_in, range_offset)
res = ""
res << l(:charts_show_last) << " "
- res = l(:charts_show_last) << " "
res << text_field_tag(:range_steps, range_steps, :size => 4)
res << hidden_field_tag(:range_offset, range_offset) << " "
Removing the res = l line solved it, now I am not sure if it came from the git repository like that or if I have caused the problem my self when trying to fix something else... if you could please check on your source code, just in case, it would be perfect
Now it looks like this
def show_date_condition(range_steps, range_in, range_offset)
res = ""
res << l(:charts_show_last) << " "
res << text_field_tag(:range_steps, range_steps, :size => 4)
res << hidden_field_tag(:range_offset, range_offset) << " "
Thanks a lot
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov almost 15 years ago
Actually, lines with '-' before them in my snippets are parts of the original code which meant to be removed and replaced with lines with '+' signs before them. '+' sign itself should be removed as well.
RE: redmine_charts patch for Redmine0.9.0 - Added by Fabio Leitao almost 15 years ago
Hey, now that all the graphs were working fine, and we set on logging recent issues, the deviation graph (the first to work) seems to be malfunctioning.
It started to get this error messages:
Open Flash Chart IO ERROR Loading test data Error #2032 This is the URL that I tried to open:/charts_deviation/data?commit=Exibir&include_subprojects=1&page=1&project_id=geral&range_in=weeks&range_offset=1&ran
In the production.log I have found this:
Processing ChartsDeviationController#index (for 187.67.165.178 at 2010-02-13 01:03:24) [GET] Parameters: {"commit"=>"Exibir", "project_id"=>"geral", "action"=>"index", "include_subprojects"=>"1", "page"=>"1", "controller"=>"charts_deviation"} Rendering template within layouts/base Rendering charts/index Completed in 154ms (View: 90, DB: 19) | 200 OK [http://wingsbr.com/charts_deviation?page=1&project_id=geral&include_subprojects=1&commit=Exibir] Processing ChartsDeviationController#data (for 187.67.165.178 at 2010-02-13 01:03:25) [GET] Parameters: {"commit"=>"Exibir", "project_id"=>"geral", "action"=>"data", "include_subprojects"=>"1", "page"=>"1", "range_in"=>"weeks", "range_steps"=>"10", "controller"=>"charts_deviation", "range_offset"=>"1"} NoMethodError (undefined method `-' for nil:NilClass): vendor/plugins/redmine_charts/app/controllers/charts_deviation_controller.rb:39:in `get_data' vendor/plugins/redmine_charts/app/controllers/charts_deviation_controller.rb:33:in `each' vendor/plugins/redmine_charts/app/controllers/charts_deviation_controller.rb:33:in `each_with_index' vendor/plugins/redmine_charts/app/controllers/charts_deviation_controller.rb:33:in `get_data' vendor/plugins/redmine_charts/app/controllers/charts_controller.rb:85:in `data' /usr/lib/ruby/1.8/mongrel.rb:159:in `process_client' /usr/lib/ruby/1.8/mongrel.rb:158:in `each' /usr/lib/ruby/1.8/mongrel.rb:158:in `process_client' /usr/lib/ruby/1.8/mongrel.rb:285:in `run' /usr/lib/ruby/1.8/mongrel.rb:285:in `initialize' /usr/lib/ruby/1.8/mongrel.rb:285:in `new' /usr/lib/ruby/1.8/mongrel.rb:285:in `run' /usr/lib/ruby/1.8/mongrel.rb:268:in `initialize' /usr/lib/ruby/1.8/mongrel.rb:268:in `new' /usr/lib/ruby/1.8/mongrel.rb:268:in `run' Rendering /home/corp/www/rails/redmine/public/500.html (500 Internal Server Error)
And literally, the only thing which has changed since yesterday were the time allocations themselves, some integer numbers and some real number, as I did in the past.
Any idea?
deviation3.png (20 KB) deviation3.png | screen capture of deviation error message |
RE: redmine_charts patch for Redmine0.9.0 - Added by Enterux Solutions over 14 years ago
I get the following error in this plugin:
I'm using Redmine 0.9.2 On CentOS 5 with Rails 2.3.5
Processing ChartsRatioController#index (for 192.168.1.221 at 2010-03-05 20:02:01) [GET] Parameters: {"action"=>"index", "controller"=>"charts_ratio"} Rendering template within layouts/base Rendering common/404 (404) Filter chain halted as [:find_project] rendered_or_redirected. Completed in 15ms (View: 12, DB: 0) | 404 Not Found [http://192.168.1.8/charts_ratio]
I tried doing the changes in this post but still getting the 404 error. Could you please guide me here.
Thanks a lot in advance!
RE: redmine_charts patch for Redmine0.9.0 - Added by Vitaly Klimov over 14 years ago
It seems that you have not modified routes.rb as required in Rails 2.3.4+
Please read details here: http://www.redmine.org/boards/3/topics/8406
RE: redmine_charts patch for Redmine0.9.0 - Added by dj jones about 10 years ago
This seems like more recent fork - last updated in 2013 and supporting at minimum: Redmine 2.1.x