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
94fcc54e
Commit
94fcc54e
authored
Nov 14, 2023
by
Tấn Trần Thanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix comment
parent
01ef1b86
Pipeline
#1586
failed with stages
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
14 deletions
+12
-14
plugins/workflow_report/app/controllers/workflow_report_controller.rb
+4
-6
plugins/workflow_report/app/helpers/workflow_report_helper.rb
+4
-4
plugins/workflow_report/app/views/workflow_report/_daily_report.html.slim
+4
-4
No files found.
plugins/workflow_report/app/controllers/workflow_report_controller.rb
View file @
94fcc54e
...
...
@@ -16,17 +16,15 @@ class WorkflowReportController < ApplicationController
project_id
=
Project
.
find_by
(
name:
params
[
:team
]).
id
project_ids
=
Project
.
visible
.
active
.
where
(
parent_id:
project_id
).
pluck
(
:id
).
push
(
project_id
)
users_by_role
=
Project
.
find
(
project_id
).
users_by_role
leader_ids
=
User
.
all
.
where
(
admin:
1
).
pluck
(
:id
)
result
=
[]
users_by_role
.
each
{
|
key
,
_value
|
users_by_role
.
delete
(
key
)
if
key
.
is_a?
(
Role
)
&&
key
.
name
.
in?
(
%w[Manager JP TeamLead]
)
}
users_by_role
.
each
do
|
_role
,
users
|
users_by_role
.
each
do
|
role
,
users
|
users
.
each
do
|
u
|
result
<<
{
id:
u
.
id
,
fullname:
"
#{
u
.
firstname
}
#{
u
.
lastname
}
"
}
unless
leader_ids
.
include?
(
u
.
id
)
result
<<
{
id:
u
.
id
,
fullname:
"
#{
u
.
firstname
}
#{
u
.
lastname
}
"
}
unless
role
.
name
.
in?
(
%w[Manager JP TeamLead]
)
end
end
report
=
{}
result
.
each
do
|
item
|
report
[
item
[
:fullname
]]
=
WorkflowReportTimeEntries
.
query_time_entry
(
item
[
:id
],
date
[
0
].
to_i
,
date
[
1
].
to_i
,
date
[
2
].
to_i
,
project_ids
)
result
.
each
do
|
user
|
report
[
user
[
:fullname
]]
=
WorkflowReportTimeEntries
.
query_time_entry
(
user
[
:id
],
date
[
0
].
to_i
,
date
[
1
].
to_i
,
date
[
2
].
to_i
,
project_ids
)
end
respond_to
do
|
format
|
...
...
plugins/workflow_report/app/helpers/workflow_report_helper.rb
View file @
94fcc54e
module
WorkflowReportHelper
def
build_report
(
entr
ie
)
done_ratio
=
entr
ie
.
issue
.
done_ratio
github_issue_id
=
entr
ie
.
issue
.
subject
.
match
(
/.*(#\d+).*/
)[
1
]
rescue
"#
#{
entrie
.
issue
.
id
}
"
text
=
"
#{
entr
ie
.
project
.
name
}#{
github_issue_id
}
:
#{
entrie
.
activity
.
name
}
-
#{
entrie
.
comments
}
"
def
build_report
(
entr
y
)
done_ratio
=
entr
y
.
issue
.
done_ratio
github_issue_id
=
entr
y
.
issue
.
subject
.
match
(
/.*(#\d+).*/
)[
1
]
rescue
"#
#{
entry
.
issue
.
id
}
"
text
=
"
#{
entr
y
.
project
.
name
}#{
github_issue_id
}
:
#{
entry
.
activity
.
name
}
-
#{
entry
.
comments
}
"
text
.
concat
(
" (
#{
done_ratio
}
%)"
)
if
done_ratio
>
0
text
...
...
plugins/workflow_report/app/views/workflow_report/_daily_report.html.slim
View file @
94fcc54e
...
...
@@ -3,12 +3,12 @@ p = "Project: #{params[:team]}"
p
=
"*Daily Report
#{
params
[
:date
]
}
*"
-
report
.
each_with_index
do
|
(
username
,
entries
),
index
|
-
total_time
=
entries
.
reduce
(
0
)
{
|
acc
,
entr
ie
|
acc
+
entrie
.
hours
}
-
total_time
=
entries
.
reduce
(
0
)
{
|
acc
,
entr
y
|
acc
+
entry
.
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
|
entr
ie
|
-
entries
.
each
do
|
entr
y
|
div
span
-
#{build_report(entr
ie
)}
-
#{build_report(entr
y
)}
-
if
display_hour
span
=
" (
#{
entr
ie
.
hours
}
h)"
span
=
" (
#{
entr
y
.
hours
}
h)"
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