Project

General

Profile

Defect #1425

when I open the code review page in project ,it occured 500 error

Added by Steven Wong almost 3 years ago. Updated over 2 years ago.

Status:
解決(Resolved)
Priority:
通常(Normal)
Assignee:
Target version:
-
Start date:
08/15/2016
Due date:
% Done:

100%

Estimated time:

Description

my environment is

Environment:
  Redmine version                3.3.0.stable.15736
  Ruby version                   2.2.4-p230 (2015-12-16) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2

error logs as follows

Started GET "/projects/uth_testteam/code_review/index" for 192.168.60.238 at 2016-08-15 16:32:08 +0800
Processing by CodeReviewController#index as HTML
  Parameters: {"id"=>"uth_testteam"}
  Current user: hui.wang (id=8)
Completed 500 Internal Server Error in 44ms (ActiveRecord: 32.7ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_request.text.erb (0.3ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.2ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.6ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_environment.text.erb (2.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_backtrace.text.erb (0.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.2.4@newgemset/gems/exception_notification-4.2.1/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (11.4ms)

ActiveRecord::StatementInvalid (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':conditions=>["project_id = ? and issue_id is NOT NULL", 2]}) FROM `code_reviews' at line 1: SELECT COUNT({:conditions=>["project_id = ? and issue_id is NOT NULL", 2]}) FROM `code_reviews`):
  plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:in `index'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Associated revisions

Revision 678723f9 (diff)
Added by Haru Iida over 2 years ago

fixes #1425 500 error when open code reviews tab

History

#1

Updated by Tomohisa Kusukawa almost 3 years ago

  • Project changed from r-labs to Code Review
  • Assignee set to Haru Iida

WorkTimeでも同様の報告(#1426)がありました。
ActiveRecordのcountメソッドが
この方の環境で動かないようです。
Redmine本体のコードを検索してみたのですが、countメソッドは使っていないようでした。
countメソッドは使わないほうが良いのでしょうかねぇ。

#2

Updated by hansugus Wong over 2 years ago

Environment:
Redmine version 3.3.1.stable
Ruby version 2.1.10-p492 (2016-04-01) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

try replace ”plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:40“ with

@review_count = CodeReview.where(["project_id = ? and issue_id is NOT NULL", @project.id]).count
@all_review_count = CodeReview.where(['project_id = ?', @project.id]).count

It work for me.:)

#3

Updated by Steven Wong over 2 years ago

Thanks, I will test it later on my environment.

by the way,
Could you please make a patch or pull request for it?
Repository url: https://bitbucket.org/haru_iida/redmine_code_review

hansugus Wong さんは書きました:

Environment:
Redmine version 3.3.1.stable
Ruby version 2.1.10-p492 (2016-04-01) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

try replace ”plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:40“ with
[...]

It work for me.:)

#4

Updated by Steven Wong over 2 years ago

Great, it worked for me, too
Thanks.

hansugus Wong さんは書きました:

Environment:
Redmine version 3.3.1.stable
Ruby version 2.1.10-p492 (2016-04-01) [x86_64-linux]
Rails version 4.2.7.1
Environment production
Database adapter Mysql2

try replace ”plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:40“ with
[...]

It work for me.:)

#5

Updated by Haru Iida over 2 years ago

  • Status changed from 新規(New) to 解決(Resolved)
  • % Done changed from 0 to 100

更新履歴 commit:a31e21754a98 で適用されました。

#6

Updated by Haru Iida over 2 years ago

Sorry for my late response and thank you for your corporation.
I've just merged the code.

Also available in: Atom PDF