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/app/views/adburndown/show.html.erb b/app/views/adburndown/show.html.erb index be39c15..8a72a6c 100644 --- a/app/views/adburndown/show.html.erb +++ b/app/views/adburndown/show.html.erb @@ -6,7 +6,7 @@ + +
+
+

<%= l(:label_menu_burndown) %>

@@ -58,5 +62,3 @@
-
-
\ No newline at end of file diff --git a/assets/javascripts/burndown.js b/assets/javascripts/burndown.js index 9d03f1f..4785458 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) @@ -45,7 +46,7 @@ var Burndown = function ($) { if (!tasks.hasOwnProperty(id)) continue; - tasks[id].created_on = Date.fromMysql(tasks[id].created_on); + tasks[id].sprints_tasks.created_on = Date.fromMysql(tasks[id].sprints_tasks.created_on); } // loop through changes for (i = 0, len = changes.length; i < len; ) @@ -59,7 +60,7 @@ var Burndown = function ($) { if (!tasks.hasOwnProperty(id)) continue; - var task = tasks[id]; + var task = tasks[id].sprints_tasks; // delete tasks, that was created after current date if (task.created_on > dateTime) delete tasks[id]; @@ -76,9 +77,9 @@ var Burndown = function ($) while (dateTime == changeDate) { if (changes[i].prop_key == 'done_ratio') - tasks[changes[i].issueId].done_ratio = changes[i].value; + tasks[changes[i].issueid].sprints_tasks.done_ratio = changes[i].value; else - tasks[changes[i].issueId].estimated_hours = changes[i].value; + tasks[changes[i].issueid].sprints_tasks.estimated_hours = changes[i].value; // next change i++; if (i >= len) @@ -209,4 +210,4 @@ var Burndown = function ($) }); return obj; -}(jQuery); \ No newline at end of file +}(jQuery);