Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redmine_v2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
redmine_v2
Commits
1cbaf3c8
Commit
1cbaf3c8
authored
Nov 14, 2023
by
Tấn Trần Thanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
done daily report
parent
55e9704c
Pipeline
#1579
canceled with stages
in 0 seconds
Changes
10
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
1 deletions
+101
-1
plugins/workflow_report/app/controllers/workflow_report_controller.rb
+28
-1
plugins/workflow_report/app/helpers/workflow_report_helper.rb
+10
-0
plugins/workflow_report/app/models/workflow_report_time_entries.rb
+10
-0
plugins/workflow_report/app/views/workflow_report/_daily_report.html.slim
+14
-0
plugins/workflow_report/app/views/workflow_report/_side_content.html.slim
+5
-0
plugins/workflow_report/app/views/workflow_report/build_report.js.erb
+3
-0
plugins/workflow_report/app/views/workflow_report/index.html.slim
+3
-0
plugins/workflow_report/app/views/workflow_report/index_daily_report.html.slim
+18
-0
plugins/workflow_report/assets/stylesheets/style.css
+8
-0
plugins/workflow_report/config/routes.rb
+2
-0
No files found.
plugins/workflow_report/app/controllers/workflow_report_controller.rb
View file @
1cbaf3c8
...
@@ -3,11 +3,38 @@ require 'csv'
...
@@ -3,11 +3,38 @@ require 'csv'
class
WorkflowReportController
<
ApplicationController
class
WorkflowReportController
<
ApplicationController
before_action
:authorize_global
before_action
:authorize_global
before_action
:require_xhr_request
,
only: :export
before_action
:require_xhr_request
,
only: :export
LEADER_IDS
=
[
172
,
229
,
271
,
142
,
6
]
def
index
def
index
@team_options
=
$workflow_report_config
[
'teams'
].
map
{
|
team
|
team
.
keys
()
}
@team_options
=
$workflow_report_config
[
'teams'
].
map
{
|
team
|
team
.
keys
()
}
end
end
def
index_daily_report
@team_options
=
Project
.
visible
.
sorted
.
active
end
def
show_daily_report
project_id
=
Project
.
find_by
(
name:
params
[
:team
]).
id
users_by_role
=
Project
.
find
(
project_id
).
users_by_role
result
=
[]
users_by_role
.
each
{
|
key
,
_value
|
users_by_role
.
delete
(
key
)
if
key
.
is_a?
(
Role
)
&&
(
key
.
name
==
'Manager'
||
key
.
name
==
'JP'
||
key
.
name
==
'TeamLead'
)
}
users_by_role
.
keys
.
each
do
|
role
|
users_by_role
[
role
].
each
do
|
u
|
if
!
LEADER_IDS
.
include?
(
u
.
id
)
result
<<
{
id:
u
.
id
,
fullname:
"
#{
u
.
firstname
}
#{
u
.
lastname
}
"
}
end
end
end
report
=
{}
result
.
each
do
|
item
|
report
[
item
[
:fullname
]]
=
WorkflowReportTimeEntries
.
query_time_entry
(
item
[
:id
])
end
respond_to
do
|
format
|
format
.
js
{
render
'build_report'
,
locals:
{
report:
report
,
display_hour:
params
[
:display_hour
]
}
}
end
end
def
export
def
export
thead
=
[
'root_id'
,
'project'
,
'subject'
,
'target_version'
,
' created_on '
,
'closed_on '
,
'due_date '
,
' status '
,
'Estimated_hours (*final version) '
,
'Actual time'
,
'Diff'
,
'Estimated_hours (*Initial version)'
,
thead
=
[
'root_id'
,
'project'
,
'subject'
,
'target_version'
,
' created_on '
,
'closed_on '
,
'due_date '
,
' status '
,
'Estimated_hours (*final version) '
,
'Actual time'
,
'Diff'
,
'Estimated_hours (*Initial version)'
,
'Number of estimation changes'
,
'Note of estimation changes'
,
'1. Requirement'
,
'2. Design'
,
'3. Coding'
,
'4. Testing'
,
'5. Bug fixing'
,
'6. Release'
,
'Others'
,
'1. Requirement'
,
'2. Design'
,
'3. Coding'
,
'Number of estimation changes'
,
'Note of estimation changes'
,
'1. Requirement'
,
'2. Design'
,
'3. Coding'
,
'4. Testing'
,
'5. Bug fixing'
,
'6. Release'
,
'Others'
,
'1. Requirement'
,
'2. Design'
,
'3. Coding'
,
...
@@ -17,7 +44,7 @@ class WorkflowReportController < ApplicationController
...
@@ -17,7 +44,7 @@ class WorkflowReportController < ApplicationController
result
=
fetch_data
(
project_ids
,
params
[
:year
].
to_i
,
params
[
:month
].
to_i
,
column_number:
thead
.
size
)
result
=
fetch_data
(
project_ids
,
params
[
:year
].
to_i
,
params
[
:month
].
to_i
,
column_number:
thead
.
size
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
js
{
render
'build_table'
,
locals:
{
result:
result
,
thead:
thead
}
}
format
.
js
{
render
'build_table'
,
locals:
{
result:
result
,
thead:
thead
}
}
end
end
end
end
...
...
plugins/workflow_report/app/helpers/workflow_report_helper.rb
0 → 100644
View file @
1cbaf3c8
module
WorkflowReportHelper
def
build_report
(
entrie
)
done_ratio
=
entrie
.
issue
.
done_ratio
github_issue_id
=
entrie
.
issue
.
subject
.
match
(
/.*(#\d+).*/
)[
1
]
rescue
"#
#{
entrie
.
issue
.
id
}
"
text
=
"
#{
entrie
.
project
.
name
}#{
github_issue_id
}
:
#{
entrie
.
activity
.
name
}
-
#{
entrie
.
comments
}
"
text
.
concat
(
" (
#{
done_ratio
}
%)"
)
if
done_ratio
>
0
text
end
end
plugins/workflow_report/app/models/workflow_report_time_entries.rb
0 → 100644
View file @
1cbaf3c8
class
WorkflowReportTimeEntries
<
TimeEntry
scope
:query_time_entry
,
->
(
user_id
)
{
where
(
"
#{
TimeEntry
.
table_name
}
.user_id = ? AND
#{
TimeEntry
.
table_name
}
.spent_on BETWEEN ? AND ?"
,
user_id
,
DateTime
.
current
.
beginning_of_day
-
9
.
hours
,
DateTime
.
current
.
end_of_day
-
9
.
hours
).
joins
(
:activity
,
:project
).
references
(
:issue
=>
[
:tracker
,
:status
]).
includes
(
:issue
=>
[
:tracker
,
:status
,
:assigned_to
,
:priority
]).
order
(
"
#{
TimeEntry
.
table_name
}
.spent_on DESC,
#{
Project
.
table_name
}
.name ASC,
#{
Tracker
.
table_name
}
.position ASC,
#{
Issue
.
table_name
}
.id ASC"
)
}
end
\ No newline at end of file
plugins/workflow_report/app/views/workflow_report/_daily_report.html.slim
0 → 100644
View file @
1cbaf3c8
-
display_hour
=
display_hour
.
to_boolean
if
display_hour
.
is_a?
(
String
)
p
=
"*Daily Report
#{
Date
.
current
.
strftime
(
"%Y-%m-%d"
)
}
*"
-
report
.
each_with_index
do
|
(
username
,
entries
),
index
|
-
total_time
=
entries
.
reduce
(
0
)
{
|
acc
,
entrie
|
acc
+
entrie
.
hours
}
.mt-10
class
=
(
"bg-danger"
if
total_time
<
8)
span
=
"
#{
(
index
+
1
).
to_s
}
.
#{
username
}
#{
'('
+
total_time
.
to_s
+
'h)'
if
display_hour
}
"
-
entries
.
each
do
|
entrie
|
div
span
-
#{build_report(entrie)}
-
if
display_hour
span
=
" (
#{
entrie
.
hours
}
h)"
plugins/workflow_report/app/views/workflow_report/_side_content.html.slim
0 → 100644
View file @
1cbaf3c8
h3
Report
ul
li
=
link_to
'Workflow Report'
,
workflow_report_path
li
=
link_to
'Daily Report'
,
workflow_report_daily_path
\ No newline at end of file
plugins/workflow_report/app/views/workflow_report/build_report.js.erb
0 → 100644
View file @
1cbaf3c8
<%
display_hour
=
display_hour
||
false
%>
$("#daily_report").html("
<%=
escape_javascript
(
render
partial:
'daily_report'
,
locals:
{
report:
report
,
display_hour:
display_hour
}
)
%>
")
plugins/workflow_report/app/views/workflow_report/index.html.slim
View file @
1cbaf3c8
=
stylesheet_link_tag
'style'
,
plugin:
'workflow_report'
=
stylesheet_link_tag
'style'
,
plugin:
'workflow_report'
=
javascript_include_tag
(
:application
,
:plugin
=>
'workflow_report'
)
=
javascript_include_tag
(
:application
,
:plugin
=>
'workflow_report'
)
=
content_for
:sidebar
do
=
render
'side_content'
fieldset
.box.tabular
fieldset
.box.tabular
legend
legend
|
EXPORT WORKFLOW
|
EXPORT WORKFLOW
...
...
plugins/workflow_report/app/views/workflow_report/index_daily_report.html.slim
0 → 100644
View file @
1cbaf3c8
=
stylesheet_link_tag
'style'
,
plugin:
'workflow_report'
=
javascript_include_tag
(
:application
,
:plugin
=>
'workflow_report'
)
=
content_for
:sidebar
do
=
render
'side_content'
fieldset
.box.tabular
legend
|
DAILY REPORT
=
form_tag
workflow_report_daily_export_path
,
method: :get
,
remote:
true
,
id:
'export-form'
do
p
=
label
:team
,
'Team'
=
select_tag
:team
,
options_for_select
(
@team_options
),
{
prompt:
"Select team"
}
p
=
label
:display_hour
,
'Display hour'
=
check_box_tag
:display_hour
,
'1'
,
true
=
submit_tag
'export'
,
id:
'export'
#daily_report
plugins/workflow_report/assets/stylesheets/style.css
View file @
1cbaf3c8
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
height
:
100vh
;
height
:
100vh
;
}
}
#daily_report
{
min-height
:
80vh
;
}
table
{
table
{
display
:
inline-block
;
display
:
inline-block
;
table-layout
:
fixed
;
table-layout
:
fixed
;
...
@@ -26,6 +30,10 @@ table {
...
@@ -26,6 +30,10 @@ table {
z-index
:
1
;
z-index
:
1
;
}
}
.mt-10
{
margin-top
:
10px
;
}
.green
{
.green
{
background-color
:
#92ce92
;
background-color
:
#92ce92
;
}
}
...
...
plugins/workflow_report/config/routes.rb
View file @
1cbaf3c8
...
@@ -3,3 +3,5 @@
...
@@ -3,3 +3,5 @@
get
'workflow_report'
,
to:
'workflow_report#index'
get
'workflow_report'
,
to:
'workflow_report#index'
get
'workflow_report/export'
,
to:
'workflow_report#export'
get
'workflow_report/export'
,
to:
'workflow_report#export'
get
'workflow_report/daily'
,
to:
'workflow_report#index_daily_report'
get
'workflow_report/daily/export'
,
to:
'workflow_report#show_daily_report'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment