Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trackers.name to tasks showing on Sprints page. #47

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
.svn
.svn
*.iml
8 changes: 4 additions & 4 deletions app/models/sprints_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ 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', :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}
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 All @@ -37,7 +37,7 @@ def self.get_tasks_by_sprint(project, sprint)
cond << sprint
end
end
SprintsTasks.find(:all, :order => SprintsTasks::ORDER, :conditions => cond, :joins => :status, :include => :assigned_to).each{|task| tasks << task}
SprintsTasks.find(:all, :select => 'issues.*, trackers.name AS t_name', :order => SprintsTasks::ORDER, :conditions => cond, :joins => :status, :joins => "left join issue_statuses on issue_statuses.id = status_id left join trackers on trackers.id = tracker_id", :include => :assigned_to).each{|task| tasks << task}
return tasks
end

Expand Down Expand Up @@ -74,4 +74,4 @@ def update_and_position!(params)
self.init_journal(User.current)
update_attributes attribs
end
end
end
3 changes: 2 additions & 1 deletion app/views/adsprints/_task.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div id="task.<%=h task.id %>" class="sc_task <%= @closed_status == task.status_id ? 'closed_task' : '' %>">
<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="task_subject"><%=h task.subject %></div>
<div class="task_estimate fl"><%=h task.estimated_hours || l(:label_sprints_placeholder_estimated) %></div>
<div class="task_owner fr"><%=h task.assigned_to %></div>
</div>
</div>
3 changes: 2 additions & 1 deletion app/views/adtasks/_task.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div id="task.<%=h task.id %>" class="sc_task">
<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="task_subject" title="<%=h task.subject %>"><%=h task.subject %></div>
<div class="task_row">
<div class="task_doneratio_slide"></div>
Expand All @@ -21,4 +22,4 @@
<div class="measure fr">h</div>
<div class="fr task_spent_time"><%=h task.spent || '0' %></div>
</div>
</div>
</div>
10 changes: 5 additions & 5 deletions assets/javascripts/burndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,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; )
Expand All @@ -59,7 +59,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];
Expand All @@ -76,9 +76,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)
Expand Down Expand Up @@ -209,4 +209,4 @@ var Burndown = function ($)
});

return obj;
}(jQuery);
}(jQuery);
2 changes: 2 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

project_module :scrum do
permission :sprints, {:adsprints => [:list], :adtaskinl => [:update, :inplace, :create, :tooltip], :adsprintinl => [:create, :inplace]}
permission :sprints_readonly, {:adsprints => [:list]}
permission :sprints_tasks, {:adtasks => [:list], :adtaskinl => [:update, :inplace, :tooltip, :spent]}
permission :sprints_tasks_readonly, {:adtasks => [:list]}
permission :burndown_charts, {:adburndown => [:show]}
end

Expand Down