Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bf13fa05
Commit
bf13fa05
authored
Oct 29, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Timelog model to persist spent time on Issues/MergeRequests.
parent
2a2e2906
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
0 deletions
+26
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-0
app/models/timelog.rb
app/models/timelog.rb
+3
-0
db/migrate/20161030020610_create_timelogs.rb
db/migrate/20161030020610_create_timelogs.rb
+12
-0
db/schema.rb
db/schema.rb
+10
-0
No files found.
app/models/concerns/issuable.rb
View file @
bf13fa05
...
...
@@ -37,6 +37,7 @@ module Issuable
has_many
:label_links
,
as: :target
,
dependent: :destroy
has_many
:labels
,
through: :label_links
has_many
:todos
,
as: :target
,
dependent: :destroy
has_many
:timelogs
,
as: :trackable
,
dependent: :destroy
has_one
:metrics
...
...
app/models/timelog.rb
0 → 100644
View file @
bf13fa05
class
Timelog
<
ActiveRecord
::
Base
belongs_to
:trackable
,
polymorphic:
true
end
db/migrate/20161030020610_create_timelogs.rb
0 → 100644
View file @
bf13fa05
class
CreateTimelogs
<
ActiveRecord
::
Migration
def
change
create_table
:timelogs
do
|
t
|
t
.
integer
:time_spent
,
null:
false
t
.
references
:trackable
,
polymorphic:
true
t
.
timestamps
null:
false
end
add_index
:timelogs
,
[
:trackable_type
,
:trackable_id
]
end
end
db/schema.rb
View file @
bf13fa05
...
...
@@ -1253,6 +1253,16 @@ ActiveRecord::Schema.define(version: 20161106185620) do
add_index
"tags"
,
[
"name"
],
name:
"index_tags_on_name"
,
unique:
true
,
using: :btree
create_table
"timelogs"
,
force: :cascade
do
|
t
|
t
.
integer
"time_spent"
,
null:
false
t
.
integer
"trackable_id"
t
.
string
"trackable_type"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"timelogs"
,
[
"trackable_type"
,
"trackable_id"
],
name:
"index_timelogs_on_trackable_type_and_trackable_id"
,
using: :btree
create_table
"todos"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
...
...
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