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
655821f3
Commit
655821f3
authored
Dec 15, 2021
by
Lee Tickett
Committed by
Stan Hu
Dec 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set spent time when using timelogs API
parent
4831b598
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
2 deletions
+20
-2
db/migrate/20211213130324_update_timelogs_spent_at_default.rb
...igrate/20211213130324_update_timelogs_spent_at_default.rb
+7
-0
db/schema_migrations/20211213130324
db/schema_migrations/20211213130324
+1
-0
db/structure.sql
db/structure.sql
+1
-1
spec/models/timelog_spec.rb
spec/models/timelog_spec.rb
+11
-1
No files found.
db/migrate/20211213130324_update_timelogs_spent_at_default.rb
0 → 100644
View file @
655821f3
# frozen_string_literal: true
class
UpdateTimelogsSpentAtDefault
<
Gitlab
::
Database
::
Migration
[
1.0
]
def
change
change_column_default
(
:timelogs
,
:spent_at
,
from:
nil
,
to:
->
{
'NOW()'
})
end
end
db/schema_migrations/20211213130324
0 → 100644
View file @
655821f3
2267855b2f12747b1f31f392677fac4d4f82ee234d7c54fd209b8bad417c8c75
\ No newline at end of file
db/structure.sql
View file @
655821f3
...
@@ -19916,7 +19916,7 @@ CREATE TABLE timelogs (
...
@@ -19916,7 +19916,7 @@ CREATE TABLE timelogs (
updated_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
issue_id integer,
issue_id integer,
merge_request_id integer,
merge_request_id integer,
spent_at timestamp without time zone,
spent_at timestamp without time zone
DEFAULT now()
,
note_id integer,
note_id integer,
project_id integer,
project_id integer,
summary text,
summary text,
spec/models/timelog_spec.rb
View file @
655821f3
...
@@ -21,7 +21,7 @@ RSpec.describe Timelog do
...
@@ -21,7 +21,7 @@ RSpec.describe Timelog do
it
{
expect
(
subject
.
project_id
).
not_to
be_nil
}
it
{
expect
(
subject
.
project_id
).
not_to
be_nil
}
describe
'
Issuable
validation'
do
describe
'validation'
do
it
'is invalid if issue_id and merge_request_id are missing'
do
it
'is invalid if issue_id and merge_request_id are missing'
do
subject
.
attributes
=
{
issue:
nil
,
merge_request:
nil
}
subject
.
attributes
=
{
issue:
nil
,
merge_request:
nil
}
...
@@ -139,4 +139,14 @@ RSpec.describe Timelog do
...
@@ -139,4 +139,14 @@ RSpec.describe Timelog do
time
+
1
.
day
time
+
1
.
day
end
end
end
end
describe
'hooks'
do
describe
'.set_project'
do
it
'populates project with issuable project'
do
timelog
=
create
(
:issue_timelog
,
issue:
issue
)
expect
(
timelog
.
project_id
).
to
be
(
timelog
.
issue
.
project_id
)
end
end
end
end
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