pharmazone / redmine_charts2

Plugin which integrates with Redmine 2.0.3 and 2.1.x following charts: burndown, timeline, ratios of logged hours and issues, deviations of logged hours.
http://github.com/pharmazone/redmine_charts2
MIT License
51 stars 22 forks source link

deviation throws internal error #12

Closed mrMoe closed 11 years ago

mrMoe commented 11 years ago
Started GET "/redmine/charts/deviation/intern" for 127.0.0.1 at 2012-12-28 13:36:02 +0100
Processing by ChartsDeviationController#index as HTML
  Parameters: {"project_id"=>"intern"}
  Current user: m.herrmann (id=4)
Completed 500 Internal Server Error in 54ms

ArgumentError (comparison of ChartTimeEntry with ChartTimeEntry failed):
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `sort!'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `get_data'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:111:in `create_chart'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:84:in `index'
  actionpack (3.2.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.9) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.9) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.9) lib/active_support/callbacks.rb:480:in `_run__2188122617939555601__process_action__1952013568057386601__callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.9) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.9) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.9) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.9) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.9) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.9) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.9) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.9) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.9) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.9) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.9) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.9) lib/action_dispatch/routing/route_set.rb:601:in `call'
  rack-openid (1.3.1) lib/rack/openid.rb:98:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.1) lib/rack/etag.rb:23:in `call'
  rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'

greetings moe

pharmazone commented 11 years ago

Show me information about Redmine installation(Admin -> Informations).

mrMoe commented 11 years ago

<pre Environment: Redmine version 2.2.0.stable.11086 Ruby version 1.9.3 (x86_64-linux) Rails version 3.2.9 Environment production Database adapter Mysql2 Redmine plugins: redmine_charts2 0.2.1 redmine_lightbox 0.0.1 redmine_time_tracker 0.5

pharmazone commented 11 years ago

Do You can reproduce this issue now? May I should close this ticket?

mrMoe commented 11 years ago

Error still here :(

Started GET "/redmine/charts/deviation/intern" for 127.0.0.1 at 2013-01-06 15:48:11 +0100
Processing by ChartsDeviationController#index as HTML
  Parameters: {"project_id"=>"intern"}
  Current user: m.herrmann (id=4)
Completed 500 Internal Server Error in 218ms
ArgumentError (comparison of ChartTimeEntry with ChartTimeEntry failed):
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `sort!'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `get_data'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:111:in `create_chart'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:84:in `index'
  actionpack (3.2.10) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.10) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.10) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.10) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.10) lib/active_support/callbacks.rb:480:in `_run__756138619027856201__process_action__497847524257253034__callbacks'
  activesupport (3.2.10) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.10) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.10) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.10) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.10) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.10) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.10) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.10) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.10) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.10) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.10) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.10) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.10) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.10) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.10) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.10) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.10) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.10) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.10) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.10) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.10) lib/action_dispatch/routing/route_set.rb:601:in `call'
  rack-openid (1.3.1) lib/rack/openid.rb:98:in `call'
  actionpack (3.2.10) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.1) lib/rack/etag.rb:23:in `call'
  rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.10) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.10) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.10) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.10) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.10) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.10) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
pharmazone commented 11 years ago

I can't reproduce your problem.

I wrote simple path https://dl.dropbox.com/u/10745857/deviation_log.patch pls apply it the redmine_charts2 plugin folder and send me back string started with [error] from your log.

mrMoe commented 11 years ago

it seems your log-code is never reached

Started GET "/redmine/charts/deviation/intern" for 127.0.0.1 at 2013-01-07 09:20:55 +0100
Processing by ChartsDeviationController#index as HTML
  Parameters: {"project_id"=>"intern"}
  Current user: m.herrmann (id=4)
Completed 500 Internal Server Error in 680ms
NameError (undefined local variable or method `log' for #):
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:14:in `block (2 levels) in get_data'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:13:in `each'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:13:in `block in get_data'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `sort!'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `get_data'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:111:in `create_chart'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:84:in `index'
  actionpack (3.2.10) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.10) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.10) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.10) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.10) lib/active_support/callbacks.rb:480:in `_run__2181060905339516416__process_action__3031730577076037783__callbacks'
  activesupport (3.2.10) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.10) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.10) lib/active_support/callbacks.rb:81:in `run_callbacks'
 

charts_deviation_controller.rb starts like

  class ChartsDeviationController < ChartsController

  unloadable

  protected

  def get_data
  rows = ChartTimeEntry.get_aggregation(:issue_id, @conditions)

  done_ratios = ChartDoneRatio.get_aggregation_for_issue(@conditions)

rows.sort! do |row1, row2|
  [row1, row2].each do |r|
    log.error "IssueId: #{r.root_id}, Subject: '#{r.subject}', GroupID: #{r.group_id}, Number of entries: #{r.entries}"
  end

  row1.group_id <=> row2.group_id
end

labels = []
max = 0
bishma-stornelli commented 11 years ago

I'm having the same issue here. The log after applying the patch gave me this output:

IssueId: , Subject: '', GroupID: 0, Number of entries: 1
IssueId: 112, Subject: 'Se desea mayor control sobre los permisos de la aplicación', GroupID: 112, Number of entries: 1
Completed 500 Internal Server Error in 451ms

ArgumentError (comparison of ChartTimeEntry with ChartTimeEntry failed):
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `sort!'
  plugins/redmine_charts2/app/controllers/charts_deviation_controller.rb:12:in `get_data'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:111:in `create_chart'
  plugins/redmine_charts2/app/controllers/charts_controller.rb:84:in `index'

Any thoughts?

bishma-stornelli commented 11 years ago

I found the problem. It was comparing String <=> Integer because row1.group_id == '0'.

The solution is to convert group_id to Integer when comparing:

    rows.sort! do |row1, row2|
      row1.group_id.to_i <=> row2.group_id.to_i
    end
pharmazone commented 11 years ago

Thanks, @bishma-stornelli