zyxware / redmine-schedules-plugin

This is a fork of the standard schedules plugin in redmine with an added feature that allows users to select either a monthly view or a weekly view in the forms and reports
Other
7 stars 3 forks source link

divided by 0 when calling report per day per member #11

Open cforce opened 13 years ago

cforce commented 13 years ago

The reason seems to be that the logged_total var has value zero, because no hours are logged for some users. I added "if logged_total > 0" to skip if value is 0 So line app/views/schedules/_report_criteria.html.erb:28 changed to

<%= progress_bar (logged_total/total <= 1 ? 100*logged_total/total : 100), :width => '80px', :legend => html_hours("%.02f" % logged_total) if logged_total > 0 %>

F, [2011-08-29T14:38:34.233379 #31138] FATAL -- : ActionView::TemplateError (divided by 0) on line #28 of vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb: 25: <% end -%> 26: <%= html_hours("%.2f" % total) if total > 0 %> 27: <td class="hours <%= "underscheduled" if logged_total > total %> "> 28: <%= progress_bar (logged_total/total <= 1 ? 100*logged_total/total : 100), :width => '80px', :legend => html_hours("%.02f" % logged_total) %> 29: 30: 31: <% if criterias.length > level+1 -%>

vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:28:in `/'
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:28
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:11:in `each'
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:11
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:32
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:11:in `each'
vendor/plugins/redmine_schedules/app/views/schedules/_report_criteria.html.erb:11
vendor/plugins/redmine_schedules/app/views/schedules/report.html.erb:62
vendor/plugins/redmine_schedules/app/helpers/schedules_helper.rb:89:in `timelog_report'
vendor/plugins/redmine_schedules/app/helpers/schedules_helper.rb:88:in `timelog_report'
vendor/plugins/redmine_schedules/app/controllers/schedules_controller.rb:746:in `report'
passenger (2.2.14) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.14) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
passenger (2.2.14) lib/phusion_passenger/utils.rb:252:in `safe_fork'
passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'