Defect #6350

New Gantt charts : 500 error when no issue have a due date

Added by Rodrigo Guerrero about 7 years ago. Updated about 7 years ago.

Status:ClosedStart date:2010-09-10
Priority:HighDue date:
Assignee:-% Done:

0%

Category:Gantt
Target version:-
Resolution:Fixed Affected version:

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)

gantt_no_due_date_fix.diff Magnifier (1.05 KB) Pieter Nicolai, 2010-09-10 14:22


Related issues

Related to Redmine - Feature #6276: Gantt Chart rewrite Closed 2010-09-03
Duplicated by Redmine - Defect #6387: TemplateError when viewing gantt chart from parent project Closed 2010-09-14

Associated revisions

Revision 4184
Added by Eric Davis about 7 years ago

Revert "Fixed: gantt broken when no due date on project issues and versions."

It broke the tests for overdue projects and isn't a good way to fix #6350
because it makes an assumption that a project is due Today and will still
error if issue tracking is disabled.

This reverts commit a7fd592db4037d635d04ca5ce3f01d0af3f0c8ae. (r4178)

Revision 4276
Added by Jean-Philippe Lang about 7 years ago

Adds a failing test for #6350.

Revision 4280
Added by Jean-Philippe Lang about 7 years ago

Fixed: error on gantt when no issue have a due date (#6350).

History

#1 Updated by Pieter Nicolai about 7 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.

#2 Updated by Eric Davis about 7 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.

#3 Updated by 杜宇甫 杜宇 about 7 years ago

  • % Done changed from 0 to 50

#4 Updated by 杜宇甫 杜宇 about 7 years ago

  • % Done changed from 50 to 0

#5 Updated by Jean-Baptiste Barth about 7 years ago

  • Subject changed from Problem with new Gantt to New Gantt charts : 500 error when no issue have a due date

#6 Updated by Mischa The Evil about 7 years ago

I can confirm this error áfter the Gantt-rewrite. The attached patch by Pieter Nicolai solves the issue.

#7 Updated by Maciej Czub about 7 years ago

Can somebody apply attached patch to trunk, please?

#8 Updated by Jean-Baptiste Barth about 7 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)

#9 Updated by Eric Davis about 7 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'.

#10 Updated by Eric Davis about 7 years ago

I'm reverting r4178 for now. With it breaking the tests, I would have a hard time releasing 1.0.2 today.

#11 Updated by Jean-Philippe Lang about 7 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?

#12 Updated by Pieter Nicolai about 7 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.

#13 Updated by Pieter Nicolai about 7 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.

#14 Updated by Eric Davis about 7 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.

#15 Updated by Vincent Polite about 7 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?

#16 Updated by Jean-Philippe Lang about 7 years ago

  • Priority changed from Normal to High

Test added in r4276.

#17 Updated by Eric Davis about 7 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).

#18 Updated by Jean-Philippe Lang about 7 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.

Also available in: Atom PDF