Skip to content

Commit

Permalink
Merge branch 'port_to_postgres' of https://github.com/spaceshipoperat…
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiago Lima committed Mar 21, 2013
2 parents 27df4db + 0dac149 commit de91c3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/controllers/adburndown_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand All @@ -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
end
12 changes: 4 additions & 8 deletions assets/javascripts/burndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de91c3c

Please sign in to comment.