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
7295cc8e
Commit
7295cc8e
authored
Dec 18, 2023
by
Tấn Trần Thanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete redundant includes models
parent
950db87a
Pipeline
#1611
failed with stages
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
plugins/workflow_report/app/models/workflow_report_issue.rb
+1
-1
plugins/workflow_report/lib/workflow_report.rb
+6
-5
No files found.
plugins/workflow_report/app/models/workflow_report_issue.rb
View file @
7295cc8e
...
...
@@ -5,7 +5,7 @@ class WorkflowReportIssue < Issue
has_many
:workflow_report_custom_values
,
class_name:
'WorkflowReportCustomValue'
,
foreign_key:
'customized_id'
scope
:raw_tasks_records
,
->
(
year
,
month
,
project_ids
)
{
includes
(
:
project
,
:workflow_report_version
,
:workflow_report_custom_values
,
:time_entries
,
:statu
s
,
project: :enabled_modules
)
includes
(
:
time_entrie
s
,
project: :enabled_modules
)
.
where
.
not
(
projects:
{
status:
CLOSED_STATUS_PROJECT
},
issues:
{
tracker_id:
BUG_TRACKER_ID
})
.
where
(
projects:
{
id:
project_ids
},
enabled_modules:
{
name:
'time_tracking'
})
.
where
([
'((time_entries.spent_on IS NOT NULL AND time_entries.tyear = ? AND time_entries.tmonth = ?) OR (issues.closed_on BETWEEN ? AND ?))'
,
...
...
plugins/workflow_report/lib/workflow_report.rb
View file @
7295cc8e
...
...
@@ -23,8 +23,9 @@ module WorkflowReport
return
{
workflow_report:
[],
error_links:
[]
}
if
raw_tasks
.
empty?
raw_tasks
.
group_by
(
&
:root_id
).
each
do
|
root_id
,
issues
|
issue_ids
=
issues
.
map
(
&
:id
)
root_issue
=
WorkflowReportIssue
.
find
(
root_id
)
arr_issue
=
WorkflowReportIssue
.
where
(
root_id:
root_id
)
issue_ids
=
arr_issue
.
map
(
&
:id
)
root_issue
=
arr_issue
.
find
(
root_id
)
journals
=
WorkflowReportJournal
.
find_journal_by_issue_ids
(
issue_ids
).
to_a
result
[
0
]
<<
root_id
...
...
@@ -40,9 +41,9 @@ module WorkflowReport
issue_due_date
=
issue_due_dates
.
max_by
{
|
due_date
|
due_date
}
result
[
6
].
push
(
issue_due_date
.
present?
?
issue_due_date
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
:
''
)
result
[
7
].
push
(
root_issue
.
status
&
.
name
.
present?
?
root_issue
.
status
&
.
name
:
''
)
sum_estimated_hours
=
issues
.
map
(
&
:estimated_hours
).
compact
.
sum
sum_estimated_hours
=
arr_issue
.
map
(
&
:estimated_hours
).
compact
.
sum
result
[
8
]
<<
sum_estimated_hours
.
round
(
2
)
actual_time
=
issues
.
map
{
|
issue
|
issue
.
time_entries
.
sum
(
:hours
)
}.
sum
actual_time
=
TimeEntry
.
where
(
issue_id:
issue_ids
).
sum
(
:hours
)
if
actual_time
.
present?
result
[
9
]
<<
actual_time
.
round
(
2
)
result
[
10
]
<<
(
actual_time
-
sum_estimated_hours
).
round
(
2
)
...
...
@@ -61,7 +62,7 @@ module WorkflowReport
else
(
11
..
13
).
each
{
|
i
|
result
[
i
]
<<
''
}
end
issues
.
each
do
|
issue
|
arr_issue
.
each
do
|
issue
|
if
issue
.
tracker_id
==
USER_STORY_TRACKER_ID
pr_links
=
issue
.
custom_values
.
find_by
(
custom_field_id:
PR_FIELD_ID
)
&
.
value
jp_request
=
issue
.
custom_values
.
find_by
(
custom_field_id:
JP_REQUEST_FIELD_ID
)
&
.
value
...
...
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