diff --git a/app/controllers/adburndown_controller.rb b/app/controllers/adburndown_controller.rb index a41c726..b0870cb 100644 --- a/app/controllers/adburndown_controller.rb +++ b/app/controllers/adburndown_controller.rb @@ -54,7 +54,7 @@ def show @changes = [] # restcondchanges = ActiveRecord::Base::sanitize_sql(restcondtasks) restcondchanges = ActiveRecord::Base.send(:sanitize_sql, restcondtasks, '') - ActiveRecord::Base.connection.select_all("select * from (select old_value as value, journalized_id as issueId, prop_key, DATE(journals.created_on) created_on from `journals` inner join journal_details on (journals.id = journal_id) inner join issues on (issues.id = journalized_id) where journalized_type = 'Issue' and property = 'attr' and (prop_key = 'estimated_hours' or prop_key = 'done_ratio') and #{restcondchanges} order by journals.id desc) a group by `issueId`, created_on, prop_key order by created_on desc").each{|row| @changes << row} + ActiveRecord::Base.connection.select_all("select max(COALESCE(old_value::float,0)) as value, journalized_id as issueId, prop_key, DATE(journals.created_on) AS created_on from journals inner join journal_details on (journals.id = journal_id) inner join issues on (issues.id = journalized_id) where journalized_type = 'Issue' and property = 'attr' and (prop_key = 'estimated_hours' or prop_key = 'done_ratio') and #{restcondchanges} group by 2, 3, 4 order by created_on desc").each{|row| @changes << row} =begin select * from ( @@ -77,4 +77,4 @@ def find_project # @project variable must be set before calling the authorize filter @project = Project.find(params[:project_id]) end -end \ No newline at end of file +end diff --git a/assets/javascripts/burndown.js b/assets/javascripts/burndown.js index 21eae04..497e7a3 100644 --- a/assets/javascripts/burndown.js +++ b/assets/javascripts/burndown.js @@ -11,9 +11,10 @@ var Burndown = function ($) if (typeof mysql != 'string') return null; // 2011/11/03 00:00:00 +0800 - var t = mysql.split(/[\/ \-:]/); + // var t = mysql.split(/[\/ \-:]/); + var t = mysql.split('-'); // [Y, M, D] - return Date.UTC(t[0], t[1] - 1, t[2]); + return Date.UTC(t[0], t[1] - 1, t[2].substr(0,2)); }; obj.setSettings = function (s) @@ -78,15 +79,10 @@ var Burndown = function ($) while (dateTime == changeDate) { if (changes[i].prop_key == 'done_ratio') -<<<<<<< HEAD tasks[changes[i].issueId].sprints_tasks.done_ratio = changes[i].value; else tasks[changes[i].issueId].sprints_tasks.estimated_hours = changes[i].value; -======= - tasks[changes[i].issueId].sprints_tasks.done_ratio = changes[i].value; - else - tasks[changes[i].issueId].sprints_tasks.estimated_hours = changes[i].value; ->>>>>>> 7bd59bec6ef62c7007428f4afd40ed533fba18fa + // next change i++; if (i >= len)