Defect #6350
closedNew Gantt charts : 500 error when no issue have a due date
0%
Description
Eric, I update redmine and show me this error with I try to see the gantt:
Processing GanttsController#show (for 192.168.0.100 at 2010-09-10 08:58:10) [GET] Parameters: {"project_id"=>"TT-09-637-F", "action"=>"show", "controller"=>"gantts"} Rendering template within layouts/base Rendering gantts/show ActionView::TemplateError (undefined method `<=' for nil:NilClass) on line #155 of app/views/gantts/show.html.erb: 152: 153: <% top = headers_height + 10 %> 154: 155: <%= @gantt.lines(:top => top, :zoom => zoom, :g_width => g_width ) %> 156: 157: <% 158: # lib/redmine/helpers/gantt.rb:301:in `line_for_project' lib/redmine/helpers/gantt.rb:172:in `render_project' lib/redmine/helpers/gantt.rb:194:in `render_project' lib/redmine/helpers/gantt.rb:193:in `render_project' lib/redmine/helpers/gantt.rb:151:in `lines' app/views/gantts/show.html.erb:155 app/controllers/gantts_controller.rb:26 app/controllers/gantts_controller.rb:25:in `show' passenger (2.2.9) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' passenger (2.2.9) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler' passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application' passenger (2.2.9) lib/phusion_passenger/utils.rb:184:in `safe_fork' passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:349:in `handle_spawn_application' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in `__send__' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in `main_loop' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:163:in `start' passenger (2.2.9) lib/phusion_passenger/railz/application_spawner.rb:209:in `start' passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application' passenger (2.2.9) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application' passenger (2.2.9) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' passenger (2.2.9) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application' passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application' passenger (2.2.9) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in `__send__' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:352:in `main_loop' passenger (2.2.9) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' Rendering /Rails/redmine/public/500.html (500 Internal Server Error)
Files
Related issues
Updated by Anonymous almost 14 years ago
I can confirm this error. It happens when none of the issues in a project have a due date set.
I attached a quick patch i made to solve the problem. Seem to work fine for me, and I ran the test suite, no strange errors.
Updated by Eric Davis almost 14 years ago
- Category set to Gantt
- Status changed from New to 7
- Target version set to 1.1.0
- Affected version (unused) set to devel
Pieter Nicolai wrote:
I can confirm this error. It happens when none of the issues in a project have a due date set.
Thanks, I was wondering what would cause it.
Updated by Jean-Baptiste Barth almost 14 years ago
- Subject changed from Problem with new Gantt to New Gantt charts : 500 error when no issue have a due date
Updated by Mischa The Evil almost 14 years ago
I can confirm this error áfter the Gantt-rewrite. The attached patch by Pieter Nicolai solves the issue.
Updated by Maciej Czub almost 14 years ago
Can somebody apply attached patch to trunk, please?
Updated by Jean-Baptiste Barth almost 14 years ago
- Assignee changed from Eric Davis to Jean-Philippe Lang
A patch has been applied in r4178, but it breaks Project#overdue?. See http://ci.finn.de/builds/1-8-7_redmine-trunk_sqlite3/4178 (second one, the first one is stupid-simple to fix).
Either we keep this solution but with this modification :
diff --git a/app/models/project.rb b/app/models/project.rb index 29be68c..e86d246 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -438,9 +438,8 @@ class Project < ActiveRecord::Base [ issues.maximum('due_date'), shared_versions.collect(&:effective_date), - shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}, - Date.today - ].flatten.compact.max + shared_versions.collect {|v| v.fixed_issues.maximum('due_date')} + ].flatten.compact.max || Date.today end end
Or we revert it and find another solution (maybe Pieter's patch?).
Any thought about this ? (Jean-Philippe especially)
Updated by Eric Davis almost 14 years ago
- Assignee changed from Jean-Philippe Lang to Eric Davis
A problem with r4178 is that it will fail and return a nil if the issue tracking module isn't enabled.
I've been thinking about it and I think it would be best to add actual Start Date and End Date fields to projects, instead of calculating them or assuming they are 'today'.
Updated by Eric Davis almost 14 years ago
I'm reverting r4178 for now. With it breaking the tests, I would have a hard time releasing 1.0.2 today.
Updated by Jean-Philippe Lang almost 14 years ago
Eric Davis wrote:
I've been thinking about it and I think it would be best to add actual Start Date and End Date fields to projects, instead of calculating them or assuming they are 'today'.
Project start and due dates wouldn't solve the problem as they may not be set.
Why not simply fix the gantt so that it handles nil values?
Updated by Anonymous almost 14 years ago
Eric, with Start and End Date fields for projects would a issue/version with a due date past that still show up in the gantt chart? If so that would be a nice solution.
My patch will, in absence of a calculated end date, set the end date as far as the gantt view filter is set to. A more structural approach as you suggests with project fields might be better.
Updated by Anonymous almost 14 years ago
Jean-Philippe Lang wrote:
Project start and due dates wouldn't solve the problem as they may not be set.
Why not simply fix the gantt so that it handles nil values?
True, I would then propose to apply my patch to the trunk as a quick fix. That way the trunk is not broken anymore. The idea of project start and end fields is still interesting though, even outside the scope of the gantt chart.
Updated by Eric Davis almost 14 years ago
Jean-Philippe Lang wrote:
Project start and due dates wouldn't solve the problem as they may not be set.
Why not simply fix the gantt so that it handles nil values?
Yea, the Gantt will need to handle nil values no matter how Project dates are calculated.
Updated by Vincent Polite almost 14 years ago
Hello all. I ran into this issue as well, installing a new Redmine Server. I was wondering what the proposed course of action and/or recommended fix is in terms of resolving this?
Updated by Jean-Philippe Lang almost 14 years ago
- Priority changed from Normal to High
Test added in r4276.
Updated by Eric Davis almost 14 years ago
Marked the failed test as pending in r4278. Tests should never fail on a commit.
Vincent Polite wrote:
Hello all. I ran into this issue as well, installing a new Redmine Server. I was wondering what the proposed course of action and/or recommended fix is in terms of resolving this?
You will need to wait for it to be fixed. And you shouldn't be running trunk since trunk is only meant for development and will have bugs at times (like now).
Updated by Jean-Philippe Lang almost 14 years ago
- Status changed from 7 to Closed
- Assignee deleted (
Eric Davis) - Target version deleted (
1.1.0) - Resolution set to Fixed
Fixed in r4280.