Skip to content

Commit

Permalink
Mixed solution for the iRessources#47
Browse files Browse the repository at this point in the history
The ricemery's implementation [1] worked (Sprints view), but [2] failed (Tasks view) in my pgsql install. The workaround in [3] requires additional db requests (AFAIK), but is working.

So, this is a mixed solution, using [1] for Sprints and [3] for Tasks.

[1] ricemery@2bf7a3f
[2] ricemery@2fe8c22
[3] 8ff6144
  • Loading branch information
Thiago Lima committed Mar 21, 2013
1 parent 4f697e4 commit e0e3955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/models/sprints_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ def self.get_tasks_by_status(project, status, sprint, user)
user = User.current.id if user == 'current'
cond << user
end
SprintsTasks.find(:all, :select => 'issues.*, sum(hours) as spent, trackers.name AS t_name', :order => SprintsTasks::ORDER, :conditions => cond, :group => "issues.id",
:joins => [:status], :joins => "left join time_entries ON time_entries.issue_id = issues.id left join trackers on trackers.id = tracker_id", :include => [:assigned_to]).each{|task| tasks << task}
SprintsTasks.find(:all, :select => 'issues.*, sum(hours) as spent', :order => SprintsTasks::ORDER, :conditions => cond, :group => "issues.id",
:joins => [:status], :joins => "left join time_entries ON time_entries.issue_id = issues.id", :include => [:assigned_to]).each{|task| tasks << task}
# ricemery approach (2fe8c22e3efc)
# SprintsTasks.find(:all, :select => 'issues.*, sum(hours) as spent, trackers.name AS t_name', :order => SprintsTasks::ORDER, :conditions => cond, :group => "issues.id",
# :joins => [:status], :joins => "left join time_entries ON time_entries.issue_id = issues.id left join trackers on trackers.id = tracker_id", :include => [:assigned_to]).each{|task| tasks << task}
return tasks
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/adtasks/_task.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="task.<%=h task.id %>" class="sc_task sc_task_tracker_<%= Tracker.find(task.tracker_id).name %> <%= task.children.count == 0 or Tracker.find(task.tracker_id).name != 'UserStorie' ? '' : 'sc_task_hide' %>">
<div class="fl task_no">#<%= link_to task.id, :controller => 'issues', :action => 'show', :id => task %></div>
<div class="fl task_desc"><img src="<%= File.join(@plugin_path, 'images', 'task_desc.png') %>"/></div>
<div class="fl task_tracker_name"><%=h task.t_name %>&nbsp;-&nbsp;</div>
<div class="fl task_tracker_name"><%=h Tracker.find(task.tracker_id).name %>&nbsp;-&nbsp;</div>
<div class="task_subject" title="<%=h task.subject %>"><%=h task.subject %></div>
<div class="task_row">
<div class="task_doneratio_slide"></div>
Expand Down

0 comments on commit e0e3955

Please sign in to comment.