Defect #1425
when I open the code review page in project ,it occured 500 error
100%
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'
Updated by Tomohisa Kusukawa over 4 years ago
- Project changed from r-labs to Code Review
- Assignee set to Haru Iida
WorkTimeでも同様の報告(#1426)がありました。
ActiveRecordのcountメソッドが
この方の環境で動かないようです。
Redmine本体のコードを検索してみたのですが、countメソッドは使っていないようでした。
countメソッドは使わないほうが良いのでしょうかねぇ。
Updated by hansugus Wong over 4 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.
Updated by Steven Wong over 4 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 Mysql2try replace ”plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:40“ with
[...]It work for me.
Updated by Steven Wong over 4 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 Mysql2try replace ”plugins/redmine_code_review/app/controllers/code_review_controller.rb:39:40“ with
[...]It work for me.
Updated by Haru Iida over 4 years ago
- Status changed from 新規(New) to 解決(Resolved)
- % Done changed from 0 to 100
更新履歴 commit:a31e21754a98 で適用されました。
Updated by Haru Iida over 4 years ago
Sorry for my late response and thank you for your corporation.
I've just merged the code.