2016-10-03 33 views
0

你好我已经为我的公司安装了Redmine 3.3.0,一切都很顺利,但Global Stats创建了一些问题。Redmine 3.3.0,PostgreSQL上的全局统计插件

这些都是什么信息我到目前为止已经聚集:

插件不PostgreSQL的工作不管你是如果您在任何项目中已经至少一个问题是什么版本的管理平台。

它可以在任何Redmine版本上与mySQL完全兼容。

我对Ruby和SQL知之甚少,所以这可能看起来像一个家庭作业问题,但忍受着我。

这是管理平台production.log错误,当我想访问统计页面(如果再有至少创建了一个问题)

ActiveRecord::RecordNotFound (Couldn't find Project with 'id'=): 
    app/models/project.rb:310:in `find' 
    plugins/redmine_stats/app/models/stat.rb:64:in `block in authors' 
    plugins/redmine_stats/app/models/stat.rb:63:in `each' 
    plugins/redmine_stats/app/models/stat.rb:63:in `authors' 
    plugins/redmine_stats/app/controllers/stats_controller.rb:22:in `index' 
    lib/redmine/sudo_mode.rb:63:in `sudo_mode' 

的问题是,我认为这个插件如何处理PostgreSQL的查询(触目惊心,我知道。)以下代码来自stat.rb,其中Redmine日志出现错误。

#get all authors of issues 
def self.authors(project) 

return project.authors unless project == nil 

data = [] 

if project.nil? 
    ActiveRecord::Base.connection.execute("SELECT count(project_id), project_id from issues group by project_id order by count(project_id) DESC LIMIT 5").each do |row| 
       data << Project.find(row[0]) 
     end 
else 

     ActiveRecord::Base.connection.execute("SELECT count(author_id), author_id from issues where project_id = '#{project.id}' group by author_id order by count(author_id) DESC LIMIT 5").each do |row| 
       data << User.find(row[0]) 
     end 
    end 

    data 

end 

最后,这是我在本地主机管理平台环境(完全与公司服务器上的真人版一样)

Environment: 
Redmine version    3.3.0.stable 
Ruby version     2.3.0-p0 (2015-12-25) [x86_64-linux] 
Rails version     4.2.6 
Environment     production 
Database adapter    PostgreSQL 
SCM: 
    Subversion      1.8.8 
    Git       1.9.1 
    Filesystem      
Redmine plugins: 
    redmine_stats     0.0.3 

我已经发布了两个这个问题管理平台官方论坛和插件作者的GitHub的页面但至少1个月没有答案。任何帮助,将不胜感激!

回答

0

添加这些字符串\设置\ additional_environment.rb:

config.logger = Logger.new('log/logfile.log', 2, 1000000) 
config.log_level = :debug 

和加载页面时检查该日志查询。 将它们复制到任何IDE的支持的Postgres数据库和测试,如果任何结果返回

0

试试这个叉索赔来解决PostgreSQL的支持:

https://github.com/myaspm/redmine_stats_2

+0

呀之后,我无法找到一个解决方案,我改变了原始插件一点,并发布它在Redmine Stats 2名下。它到目前为止工作。很高兴看到它再次找到自己的方式:D –

+0

哈哈......今天互联网赢了。我正在寻找一个统计插件,发现你的回购和这个问题:D。您可以将PR添加到原始回购。 – althaus