256MbTeam / Redmine-Scrumbler

Easy to use plugin for Redmine. It allows users to use the Scrum/Agile process in projects. Scrumbler have interactive dashboard with the ability to configure for each sprint. Plugin adds Scrum Points field in every issue in project. Scrumbler as possible using the standard redmine structure of projects.
GNU General Public License v2.0
112 stars 41 forks source link

Error in Statistics (burndown) with postgresql DB #24

Closed danielplappert closed 12 years ago

danielplappert commented 12 years ago

Using a postgresql DB causes an error in statistics:

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: select sum(value) from custom_values where 
custom_values.custom_field_id = 10 and
custom_values.customized_type = 'Issue' and
custom_values.customized_id in (1405,0) and
custom_values.value <> '?'):
  vendor/plugins/redmine_scrumbler/app/models/scrumbler_sprint.rb:63:in `points_total'
  vendor/plugins/redmine_scrumbler/app/controllers/scrumbler_sprints_controller.rb:135:in `burndown_calc'
  vendor/plugins/redmine_scrumbler/app/controllers/scrumbler_sprints_controller.rb:116:in `burndown'

This happens because the sum function in postgresql needs a conversion, if the value is not a number or numeric type. The correct query for postgresql would be:

select sum(value::numeric) from custom_values where 
custom_values.custom_field_id = 10 and
custom_values.customized_type = 'Issue' and
custom_values.customized_id in (1405,0) and
custom_values.value <> '?')
zloydadka commented 12 years ago

can you test it after fix and comment about?

zloydadka commented 12 years ago

fixed https://github.com/256MbTeam/Redmine-Scrumbler/commit/42665a6f331f161276068495dd14475c27937ea9 update to lastest version and please test

danielplappert commented 12 years ago

I "fixed" this issue in "scrumbler_sprint.rb" (line 63 and line 77) as I described above and it worked as expected. But this is a postgresql fix only!

zloydadka commented 12 years ago

my fix should work with any db

danielplappert commented 12 years ago

I tried your patch, but it doesn't work. The "new" exception is:

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT sum("custom_values".value) AS sum_value FROM "custom_values" WHERE (custom_field_id = 10 and
      customized_type = 'Issue' and
      customized_id in (1753,1752,1711,1674,1564,1517,1404,1405,0) and
      value <> '?') 

It's still the same. The conversion is still missing for the postgresql DB.

zloydadka commented 12 years ago

i understand this error. try to checkout last commit https://github.com/256MbTeam/Redmine-Scrumbler/commit/af6b9ea313e882c3d896a26f01225b06308d5e5b i hope it's working

danielplappert commented 12 years ago

I tried your last patch and it's working correctly! Thanks.