简体   繁体   English

我们无法运行“项目状态”或“需求覆盖率”报告(模块失败)

[英]We are unable to run “Project Status” or “Requirement Coverage” Reports (with module failing)

Recently, we found that when running certain reports (Either Project Status or Requirement Coverage) the report fails with a popup showing: 最近,我们发现在运行某些报告(“项目状态”或“需求覆盖率”)时,报告将失败,并显示以下弹出窗口:

undefined method `[]' for nil:NilClass nil:NilClass的未定义方法“ []”

Examining the httpd access logs I see the following: 检查httpd访问日志,我看到以下内容:

"GET /report/requirement_coverage/?sort_by=id&test_object_ids=12 HTTP/1.1" 403 38 " http://tarantula.xxxxx.xxxx/ " “ GET / report / requirement_coverage /?sort_by = id&test_object_ids = 12 HTTP / 1.1” 403 38“ http://tarantula.xxxxx.xxxx/

in the production.log file, we also see this: 在production.log文件中,我们还看到了以下内容:

undefined method []' for nil:NilClass /opt/tarantula/rails/lib/priority_extensions.rb:9:in priority_name' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:115:in case_info' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in block (2 levels) in do_query' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in each' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in method_missing' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in block in do_query' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in each' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in each' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:66:in do_query' []' for nil:NilClass /opt/tarantula/rails/lib/priority_extensions.rb:9:in priority_name中的未定义方法[]' for nil:NilClass /opt/tarantula/rails/lib/priority_extensions.rb:9:in case_info' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in requirement_coverage.rb []' for nil:NilClass /opt/tarantula/rails/lib/priority_extensions.rb:9:in case_info' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:77:in在do_query的/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2中(2级)中。 18 / lib / active_record / associations / collection_proxy.rb:91:在each' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in method_missing'/opt block in do_query' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in each' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in 77 each' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:91:in block in do_query' /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/delegation.rb:6:in每个'/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/关系/委托each' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:66:in :6:在each' /opt/tarantula/rails/app/models/report/requirement_coverage.rb:66:in :在do_query'

lots more under this followd by: 在此之后还有更多内容:

/opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/passenger-3.0.19/helper-scripts/passenger-spawn-server:99:in `' Completed 403 Forbidden in 113381.4ms (Views: 0.2ms | ActiveRecord: 7849.2ms) /opt/tarantula/rails/vendor/bundle/ruby/1.9.1/gems/passenger-3.0.19/helper-scripts/passenger-spawn-server:99:in`'在113381.4ms中完成403禁止(查看:0.2 ms | ActiveRecord:7849.2ms)

NOTE: this is not my code, but code from a module of Testia Tarantula 注意:这不是我的代码,而是来自Testia Tarantula模块的代码

=begin rdoc

Include this in a model which is to be prioritized.

 =end
 module PriorityExtensions

   def priority_name
     Project::Priorities.detect{|p| p[:value] == self.priority}[:name]
   end

   def priority=(p)
     if p.is_a? String
       p_val = Project::Priorities.detect{|pp| pp[:name] == p.downcase}
       if p_val
         self[:priority] = p_val[:value]
       else
         raise "Invalid priority '#{p}' for #{self.class} (id #{self.id})"
       end
     else
       self[:priority] = p
     end
   end

   def self.included(model)
     model.validates_inclusion_of :priority, :in =>           Project::Priorities.map{|p| p[:value]}
   end

 end

Found the issue, a column "priority" in the table "cases", had somehow been changed to an invalid NULL. 发现了问题,表“ cases”中的“ priority”列已以某种方式更改为无效的NULL。 Changing the value to '0' (normal) fixed the issue. 将值更改为“ 0”(正常)可解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM