Commit 6a82e8a1 by Nguyen Vo Huy Hoang

Add issue report

parent eb548d7e
Pipeline #1552 canceled with stages
in 0 seconds
......@@ -35,6 +35,7 @@ class ReportsController < ApplicationController
@issues_by_assigned_to = Issue.by_assigned_to(@project)
@issues_by_author = Issue.by_author(@project)
@issues_by_subproject = Issue.by_subproject(@project) || []
@issue_by_custom = Issue.by_custom_issues(@project)
render :template => "reports/issue_report"
end
......
......@@ -1496,6 +1496,27 @@ class Issue < ActiveRecord::Base
r.reject {|r| r["project_id"] == project.id.to_s}
end
def self.by_custom_issues(project)
root_id = TimeEntry.joins(:issue).select(:root_id).where({:tyear => Date.current.year, :tmonth => Date.current.month}).group(:root_id)
self.find_by_sql(["select * from (
select a.tracker_id, a.root_id, id,subject, due_date, estimated_hours, hours,activity,status,target_version,name,created_on, closed_on,lead_time,spent_on from (
SELECT tracker_id,root_id,subject, due_date, estimated_hours, issue_statuses.name as status, versions.name as target_version, projects.name, issues.created_on, issues.closed_on, DATEDIFF(issues.closed_on,issues.created_on) as lead_time
FROM issues INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id`
JOIN `issue_statuses` ON status_id=issue_statuses.id
LEFT JOIN `versions` ON fixed_version_id = versions.id
where issues.id in (?) and tracker_id != 1 # not bug
) a
JOIN
(SELECT root_id, hours, enumerations.name as activity, issues.id, spent_on
FROM issues
INNER JOIN `time_entries` ON `issues`.`id` = `time_entries`.`issue_id`
LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `time_entries`.`activity_id` AND `enumerations`.`type` IN ('TimeEntryActivity')
where root_id in (?)
order by spent_on desc
) b
on a.root_id = b.root_id) as total", root_id, root_id])
end
# Query generator for selecting groups of issue counts for a project
# based on specific criteria
#
......
<h2><%=l(:label_report_plural)%></h2>
<div>
<canvas id="myChart"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<h3>
<%=l(:field_issue)%>&nbsp;
<%= link_to l(:label_details),
project_issues_report_details_path(@project, :detail => 'tracker'),
:class => 'icon-only icon-zoom-in',
:title => l(:label_details) %>
Open/closed at the moment per target version, speed
your average speed, open/closed rate
</h3>
<%= render :partial => 'simple', :locals => { :data => @issue_by_custom, :field_name => "tracker_id", :rows => @trackers } %>
<br />
<h3> Possible delay tasks. Its depend on estimate/closed of "open" tasks
</h3>
<div class="splitcontentleft">
<h3>
<%=l(:field_tracker)%>&nbsp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment