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
1ecf0949
Commit
1ecf0949
authored
May 26, 2020
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Auto logtime when create new or update task
parent
c5e74175
Pipeline
#640
failed with stages
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
app/controllers/concerns/auto_timelog.rb
+14
-0
app/controllers/issues_controller.rb
+7
-0
No files found.
app/controllers/concerns/auto_timelog.rb
0 → 100644
View file @
1ecf0949
module
AutoTimelog
extend
ActiveSupport
::
Concern
# Auto create timelog tracking (26/05/2020)
def
auto_create_timelog
(
issue
)
time_entry
=
TimeEntry
.
find_by
(
:project
=>
@project
,
:issue
=>
issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
return
if
time_entry
time_entry
=
TimeEntry
.
new
(
:project
=>
@project
,
:issue
=>
issue
,
:user
=>
User
.
current
,
:spent_on
=>
User
.
current
.
today
)
time_entry
.
hours
=
0.5
time_entry
.
comments
=
'Logtime Tracking!'
time_entry
.
activity_id
=
11
#Requirement
time_entry
.
activity_id
=
29
if
issue
.
tracker_id
==
3
#Support
time_entry
.
save!
end
end
app/controllers/issues_controller.rb
View file @
1ecf0949
...
...
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class
IssuesController
<
ApplicationController
include
AutoTimelog
default_search_scope
:issues
before_action
:find_issue
,
:only
=>
[
:show
,
:edit
,
:update
]
...
...
@@ -139,6 +140,7 @@ class IssuesController < ApplicationController
end
auto_create_subtasks
(
@issue
)
auto_create_timelog
(
@issue
)
if
@issue
.
tracker_id
!=
12
# Auto create timelog tracking (26/05/2020)
return
else
...
...
@@ -196,6 +198,8 @@ class IssuesController < ApplicationController
auto_delete_subtasks
(
@issue
)
end
auto_create_timelog
(
@issue
)
# Auto create timelog tracking (26/05/2020)
else
respond_to
do
|
format
|
format
.
html
{
render
:action
=>
'edit'
}
...
...
@@ -623,8 +627,11 @@ class IssuesController < ApplicationController
subtask
.
parent_issue_id
=
@issue
.
id
subtask
.
estimated_hours
=
nil
subtask
.
save!
auto_create_timelog
(
subtask
)
if
subtask_title
==
"Requirement"
# Auto create timelog tracking (26/05/2020)
end
end
# Auto delete 8 subtasks (13/08/2018)
def
auto_delete_subtasks
(
issue
)
exclude_project_ids
=
[
106
,
107
,
108
,
109
,
110
,
111
]
#2zigexn
...
...
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