2016-10-03 71 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