TravisSpangle / redmine_spent_time_in_issue_description

Redmine Plugin that drops Time Entry data into the Issue Description
16 stars 16 forks source link

Redmine error in last version #7

Closed Pierstoval closed 9 years ago

Pierstoval commented 10 years ago

Hi man, I'm learning Ruby right now to be able to participate either to your plugin or to some others, but yet I'm still not familiar, especially with RoR.

I'd like to report a bug problem.

I checked out the last commit from your plugin today on my redmine app, and issued a quite big error, a blocking one in fact :

ActionView::Template::Error (undefined method `time_entries' for nil:NilClass):
    1: <% if User.current.allowed_to?(:view_time_entries, @project) and @issue.time_entries.present? and ( Setting.plugin_redmine_spent_time_in_issue_description['report_location'].eql? "below_revisions" or Setting.plugin_redmine_spent_time_in_issue_description['report_location'].eql? "above_revisions") %>
    2:
    3:      <script type="text/javascript">
    4:         $(document).ready(function() {
  lib/redmine/hook.rb:111:in `block in render_on'
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:158:in `call_hook'
  app/views/layouts/base.html.erb:14:in `_app_views_layouts_base_html_erb___3465933017524486431_59517160'
  app/controllers/projects_controller.rb:163:in `show'

Seems to be an error in the template, what would be the solution to debug this ? :smile:

Thanks !

TravisSpangle commented 10 years ago

Master is in development. I've created a release for the latest stable release.

johnquinnau commented 9 years ago

This is a great plugin! I'm getting the same template error with Redmine 2.6.0.stable, is your newer release available?

TravisSpangle commented 9 years ago

I'm unable to repro this issue. I'm using http://svn.redmine.org/redmine/tags/2.6.0 what version of ruby are you using?

johnquinnau commented 9 years ago

I'm afraid I'm an inexpert user, and I'm using bitnami redmine, so the problem is almost certainly something I'm doing.

Environment: Redmine version 2.6.0.stable Ruby version 2.0.0-p481 (2014-05-08) [x86_64-linux] Rails version 3.2.19 Environment production Database adapter Mysql2

Installation steps:

1. Create a Bitnami Redmine deployment Browse to https://bitnami.com/redirect/to/45129/redmine-2.6.0-1-amiubuntu-x64-ebs?region=us-east-1 Log on to (or create) an amazon web services account. Step through the EC2 instance creation process.

2. Deploy plugin cd /opt/bitnami/apps/redmine/htdocs/plugins git clone https://github.com/TravisSpangle/redmine_spent_time_in_issue_description.git cd /opt/bitnami/apps/redmine/htdocs /opt/bitnami/apps/redmine/htdocs/bin/rake redmine:plugins:migrate RAILS_ENV=production sudo /opt/bitnami/ctlscript.sh restart

Result:

Creating a new project, or viewing an existing project, gives Internal error

An error occurred on the page you were trying to access. If you continue to experience problems please contact your Redmine administrator for assistance.

If you are the Redmine administrator, check your log files for details about the error.

Installation console output: Using username "bitnami".

Authenticating with public key "imported-openssh-key"

Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-39-generic x86_64)

   ___ _ _                   _

  | _ |_) |_ _ _  __ _ _ __ (_)

  | _ \ |  _| ' \/ _` | '  \| |

  |___/_|\__|_|_|\__,_|_|_|_|_|

* Welcome to the Bitnami Redmine 2.6.0-1 *

* Bitnami Wiki: http://wiki.bitnami.com/ *

* Bitnami Forums: https://community.bitnami.com/ *

bitnami@ip-172-31-1-208:~$ cd /opt/bitnami/apps/redmine/htdocs/plugins

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs/plugins$ git clone https://github.com/TravisSpangle/redmine_spent_time_in_issue_description.git

Cloning into 'redmine_spent_time_in_issue_description'...

remote: Counting objects: 170, done.

remote: Total 170 (delta 0), reused 0 (delta 0)

Receiving objects: 100% (170/170), 55.37 KiB | 0 bytes/s, done.

Resolving deltas: 100% (43/43), done.

Checking connectivity... done.

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs/plugins$ cd /opt/bitnami/apps/redmine/htdocs

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs$ /opt/bitnami/apps/redmine/htdocs/bin/rake redmine:plugins:migrate RAILS_ENV=production

Rails Error: Unable to access log file. Please ensure that /opt/bitnami/apps/redmine/htdocs/log/production.log exists and is chmod

  1. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

Migrating redmine_spent_time_in_issue_description (Issue Description with Spent Time)...

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs$ sudo /opt/bitnami/ctlscript.sh restart

/opt/bitnami/subversion/scripts/ctl.sh : subversion stopped

Syntax OK

/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped

/opt/bitnami/php/scripts/ctl.sh : php-fpm stopped

/opt/bitnami/mysql/scripts/ctl.sh : mysql stopped

141112 00:35:13 mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.

141112 00:35:13 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data

/opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306

[12-Nov-2014 00:35:19] NOTICE: configuration file /opt/bitnami/php/etc/php-fpm.conf test is successful

/opt/bitnami/php/scripts/ctl.sh : php-fpm started

Syntax OK

/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80

/opt/bitnami/subversion/scripts/ctl.sh : subversion started at port 3690

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs$ cd plugins

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs/plugins$ cd redmine_spent_time_in_issue_description

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs/plugins/redmine_spent_time_in_issue_description$ cd /opt/bitnami/apps/redmine/htdocs

bitnami@ip-172-31-1-208:/opt/bitnami/apps/redmine/htdocs$ bundle install --without development test RAILS_ENV=production

Using rake 10.3.2

Using i18n 0.6.11

Using multi_json 1.10.1

Using activesupport 3.2.19

Using builder 3.0.4

Using activemodel 3.2.19

Using erubis 2.7.0

Using journey 1.0.4

Using rack 1.4.5

Using rack-cache 1.2

Using rack-test 0.6.2

Using hike 1.2.3

Using tilt 1.4.1

Using sprockets 2.2.2

Using actionpack 3.2.19

Using mime-types 1.25.1

Using polyglot 0.3.5

Using treetop 1.4.15

Using mail 2.5.4

Using actionmailer 3.2.19

Using arel 3.0.3

Using tzinfo 0.3.39

Using activerecord 3.2.19

Using activeresource 3.2.19

Using coderay 1.1.0

Using rack-ssl 1.3.4

Using json 1.8.1

Using rdoc 3.12.2

Using thor 0.19.1

Using railties 3.2.19

Using jquery-rails 3.1.2

Using mysql2 0.3.14

Using net-ldap 0.3.1

Using ruby-openid 2.3.0

Using rack-openid 1.4.1

Using bundler 1.7.0

Using rails 3.2.19

Using rbpdf 1.18.1

Using redcarpet 2.3.0

Using request_store 1.0.5

Using rmagick 2.13.2

Your bundle is complete!

Gems in the groups development, test and RAILS_ENV=production were not installed.

It was installed into ./vendor/bundle

/opt/bitnami/apps/redmine/htdocs/log/production.log:

Started GET "/projects/new" for 203.219.244.41 at 2014-11-12 00:50:50 +0000

Processing by ProjectsController#new as HTML

Current user: user (id=1)

Rendered projects/_form.html.erb (11.0ms)

Rendered projects/new.html.erb within layouts/base (12.9ms)

Rendered plugins/redmine_spent_time_in_issue_description/app/views/spent_time/_javascript_report.html.erb (1.5ms)

Completed 500 Internal Server Error in 28.6ms

ActionView::Template::Error (undefined method `time_entries' for nil:NilClass):

1: <% if User.current.allowed_to?(:view_time_entries, @project) and

@issue.time_entries.present? and ( Setting.plugin_redmine_spent_time_in_issue_description['report_location'].eql? "below_revisions" or Setting.plugin_redmine_spent_time_in_issue_description['report_location'].eql? "above_revisions") %>

2:

3:      <script type="text/javascript">

4:         $(document).ready(function() {

lib/redmine/hook.rb:111:in `block in render_on'

lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'

lib/redmine/hook.rb:61:in `each'

lib/redmine/hook.rb:61:in `block in call_hook'

lib/redmine/hook.rb:58:in `tap'

lib/redmine/hook.rb:58:in `call_hook'

lib/redmine/hook.rb:158:in `call_hook'

app/views/layouts/base.html.erb:14:in `_app_views_layouts_base_html_erb___1831013342424951651_70336256082920'

John Quinn Growth & Emerging Technologies Director ph: +61 4 2121 3331 - e: john@technocrat.com.au Melbourne - Canberra - Sydney - Brisbane Ph: 1300 830 500 Int: +61 2 6243 4866 technocrat.com.au http://www.technocrat.com.au/

UX AUSTRALIA PLATINUM SPONSOR DRUPALSOUTH 2014 GOLD SPONSOR DRUPALGOV CANBERRA 2014 GOLD SPONSOR DRUPALSOUTH MELBOURNE 2015 DIAMOND SPONSOR ACQUIA ENTERPRISE SELECT PARTNER & DRUPAL TRAINING PARTNER

This email and its contents are confidential and for use only by the intended recipient. If you have received it in error, please notify immediately by return email. Views and opinions are solely those of the author and do not necessarily represent those of Technocrat. Employees making defamatory statements or infringing on copyright or other legal rights operate contrary to company policy and Technocrat accepts no liability for such communications. No employee or agent is authorized to conclude any binding agreement on behalf of Technocrat with another party without express confirmation from the company director. Technocrat expects the recipient to take any steps necessary to prevent viruses and does not take any responsibility for loss or damage caused by viruses.

On 12 November 2014 05:11, Travis notifications@github.com wrote:

I'm unable to repro this issue. I'm using http://svn.redmine.org/redmine/tags/2.6.0 what version of ruby are you using?

Reply to this email directly or view it on GitHub https://github.com/TravisSpangle/redmine_spent_time_in_issue_description/issues/7#issuecomment-62590480 .

TravisSpangle commented 9 years ago

Thanks. For some reason it's the version of ruby that makes this a problem and not any of the others. I'm committing a fix please let me know if it's working for you.

johnquinnau commented 9 years ago

Great! I'll check github and apply it when it's committed.

John

John Quinn Growth & Emerging Technologies Director ph: +61 4 2121 3331 - e: john@technocrat.com.au Melbourne - Canberra - Sydney - Brisbane Ph: 1300 830 500 Int: +61 2 6243 4866 technocrat.com.au http://www.technocrat.com.au/

UX AUSTRALIA PLATINUM SPONSOR DRUPALSOUTH 2014 GOLD SPONSOR DRUPALGOV CANBERRA 2014 GOLD SPONSOR DRUPALSOUTH MELBOURNE 2015 DIAMOND SPONSOR ACQUIA ENTERPRISE SELECT PARTNER & DRUPAL TRAINING PARTNER

This email and its contents are confidential and for use only by the intended recipient. If you have received it in error, please notify immediately by return email. Views and opinions are solely those of the author and do not necessarily represent those of Technocrat. Employees making defamatory statements or infringing on copyright or other legal rights operate contrary to company policy and Technocrat accepts no liability for such communications. No employee or agent is authorized to conclude any binding agreement on behalf of Technocrat with another party without express confirmation from the company director. Technocrat expects the recipient to take any steps necessary to prevent viruses and does not take any responsibility for loss or damage caused by viruses.

On 12 November 2014 13:29, Travis notifications@github.com wrote:

Thanks. For some reason it's the version of ruby that makes this a problem and not any of the others. I'm committing a fix please let me know if it's working for you.

Reply to this email directly or view it on GitHub https://github.com/TravisSpangle/redmine_spent_time_in_issue_description/issues/7#issuecomment-62660138 .

TravisSpangle commented 9 years ago

This came from the initial commit of #4. The original code was hooked into the Issue Show page, so it always had access to the Issue and it's Time Entries method. When we moved to displaying the report floating with the revisions the JavaScript was included in every RedMine Page. It assumed it had access to Objects that were not present.

This was resolved in 1e8795a2b5ba76ea1540d7adcb9a1afdfcb7d435. The last commit would have resolved it as well. Instead of relying on hooks and JavaScript I've just extended the Issue Show view. It's cleaner and no longer depends on JavaScript.