Project

General

Profile

Actions

Defect #6350

closed

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

Added by Rodrigo Guerrero over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
Gantt
Target version:
-
Start date:
2010-09-10
Due date:
% Done:

0%

Estimated time:
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)

Files

gantt_no_due_date_fix.diff (1.05 KB) gantt_no_due_date_fix.diff Anonymous, 2010-09-10 14:22

Related issues

Related to Redmine - Feature #6276: Gantt Chart rewriteClosedEric Davis2010-09-03

Actions
Has duplicate Redmine - Defect #6387: TemplateError when viewing gantt chart from parent projectClosed2010-09-14

Actions
Actions #1

Updated by Anonymous over 13 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.

Actions #2

Updated by Eric Davis over 13 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.

Actions #3

Updated by 杜宇甫 杜宇 over 13 years ago

  • % Done changed from 0 to 50
Actions #4

Updated by 杜宇甫 杜宇 over 13 years ago

  • % Done changed from 50 to 0
Actions #5

Updated by Jean-Baptiste Barth over 13 years ago

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

Updated by Mischa The Evil over 13 years ago

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

Actions #7

Updated by Maciej Czub over 13 years ago

Can somebody apply attached patch to trunk, please?

Actions #8

Updated by Jean-Baptiste Barth over 13 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)

Actions #9

Updated by Eric Davis over 13 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'.

Actions #10

Updated by Eric Davis over 13 years ago

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

Actions #11

Updated by Jean-Philippe Lang over 13 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?

Actions #12

Updated by Anonymous over 13 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.

Actions #13

Updated by Anonymous over 13 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.

Actions #14

Updated by Eric Davis over 13 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.

Actions #15

Updated by Vincent Polite over 13 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?

Actions #16

Updated by Jean-Philippe Lang over 13 years ago

  • Priority changed from Normal to High

Test added in r4276.

Actions #17

Updated by Eric Davis over 13 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).

Actions #18

Updated by Jean-Philippe Lang over 13 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.

Actions

Also available in: Atom PDF