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
c4da9f3e
Commit
c4da9f3e
authored
Feb 28, 2024
by
Nguyen Vo Huy Hoang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bugfix/group_by_root_id' into 'master'
bugfix: group by issue root_id See merge request
!19
parents
983ef81a
d1fc3d47
Pipeline
#1632
canceled with stages
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
plugins/workflow_report/app/models/workflow_report_issue.rb
+8
-2
plugins/workflow_report/lib/workflow_report.rb
+10
-4
No files found.
plugins/workflow_report/app/models/workflow_report_issue.rb
View file @
c4da9f3e
...
...
@@ -4,13 +4,19 @@ class WorkflowReportIssue < Issue
belongs_to
:workflow_report_version
,
class_name:
'Version'
,
foreign_key:
'fixed_version_id'
has_many
:workflow_report_custom_values
,
class_name:
'WorkflowReportCustomValue'
,
foreign_key:
'customized_id'
scope
:raw_tasks_records
,
->
(
year
,
month
,
project_ids
)
{
scope
:raw_tasks_records
,
->
(
root_ids
,
project_ids
)
{
includes
(
:time_entries
,
project: :enabled_modules
)
.
where
(
root_id:
root_ids
)
.
where
.
not
(
projects:
{
status:
CLOSED_STATUS_PROJECT
},
issues:
{
tracker_id:
BUG_TRACKER_ID
,
author_id:
1
})
.
order
(
Arel
.
sql
(
"FIELD(projects.id,
#{
project_ids
.
join
(
','
)
}
)"
),
:root_id
)
}
scope
:raw_tasks_root
,
->
(
year
,
month
,
project_ids
)
{
includes
(
:time_entries
,
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 ?))'
,
year
,
month
,
DateTime
.
new
(
year
,
month
).
beginning_of_day
,
DateTime
.
new
(
year
,
month
,
-
1
).
end_of_day
])
.
order
(
Arel
.
sql
(
"FIELD(projects.id,
#{
project_ids
.
join
(
','
)
}
)"
),
:root_id
)
}
scope
:raw_task_in_date
,
->
(
date_from
,
date_to
,
project_ids
)
{
...
...
plugins/workflow_report/lib/workflow_report.rb
View file @
c4da9f3e
...
...
@@ -21,7 +21,8 @@ module WorkflowReport
error_links
=
[]
work_queue
=
Queue
.
new
result
=
TABLE_HEADER
.
length
.
times
.
map
{
[]
}
raw_tasks
=
WorkflowReportIssue
.
raw_tasks_records
(
year
,
month
,
project_ids
)
root_ids
=
WorkflowReportIssue
.
raw_tasks_root
(
year
,
month
,
project_ids
).
uniq
.
pluck
(
:root_id
)
raw_tasks
=
WorkflowReportIssue
.
raw_tasks_records
(
root_ids
,
project_ids
)
return
{
workflow_report:
[],
error_links:
[]
}
if
raw_tasks
.
empty?
raw_tasks
.
group_by
(
&
:root_id
).
each
do
|
root_id
,
issues
|
...
...
@@ -30,10 +31,14 @@ module WorkflowReport
root_issue
=
arr_issue
.
find
(
root_id
)
journals
=
WorkflowReportJournal
.
find_journal_by_issue_ids
(
issue_ids
).
to_a
target_version
=
root_issue
.
workflow_report_version
&
.
name
subject
=
issues
.
first
.
project
.
name
.
gsub
(
/[^[:print:]]/
,
''
)
next
if
(
target_version
.
present?
&&
target_version
.
include?
(
"Backlog(Internal)"
))
||
subject
.
include?
(
"Internal"
)
result
[
0
]
<<
root_id
result
[
1
]
<<
issues
.
first
.
project
.
name
.
gsub
(
/[^[:print:]]/
,
''
)
result
[
1
]
<<
subject
result
[
2
]
<<
root_issue
&
.
subject
.
gsub
(
/[^[:print:]]/
,
''
)
result
[
3
]
<<
root_issue
.
workflow_report_version
&
.
name
result
[
3
]
<<
target_version
issue_created_on
=
arr_issue
.
min_by
{
|
i
|
i
[
:created_on
]
if
i
[
:created_on
].
present?
}
result
[
4
].
push
(
issue_created_on
.
present?
?
issue_created_on
.
created_on
&
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
:
''
)
closed_on_issues
=
arr_issue
.
map
(
&
:closed_on
).
compact
...
...
@@ -195,7 +200,8 @@ module WorkflowReport
issue_custom
=
filtered_values
end
max_value_in_record
=
issue_custom
.
map
{
|
custom
|
custom
.
value
.
to_i
}.
max
max_value_in_record
=
issue_custom
.
map
{
|
custom
|
custom
.
value
}.
max
return
nil
if
max_value_in_record
.
nil?
||
max_value_in_record
.
empty?
[
max_value
,
max_value_in_record
.
to_i
].
max
end
...
...
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