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
40765c8d
Commit
40765c8d
authored
Feb 22, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle rotation start time within active period
- Add specs - Add comment for upcoming feature
parent
b74bbc71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
ee/app/graphql/mutations/incident_management/oncall_rotation/create.rb
...l/mutations/incident_management/oncall_rotation/create.rb
+2
-0
ee/lib/incident_management/oncall_shift_generator.rb
ee/lib/incident_management/oncall_shift_generator.rb
+1
-1
ee/spec/lib/incident_management/oncall_shift_generator_spec.rb
...ec/lib/incident_management/oncall_shift_generator_spec.rb
+19
-0
No files found.
ee/app/graphql/mutations/incident_management/oncall_rotation/create.rb
View file @
40765c8d
...
...
@@ -122,6 +122,8 @@ module Mutations
parsed_from
=
Time
.
parse
(
start_time
)
parsed_to
=
Time
.
parse
(
end_time
)
# Overnight shift times will be supported via
# https://gitlab.com/gitlab-org/gitlab/-/issues/322079
if
parsed_to
<
parsed_from
raise
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
"'start_time' time must be before 'end_time' time"
end
...
...
ee/lib/incident_management/oncall_shift_generator.rb
View file @
40765c8d
...
...
@@ -132,7 +132,7 @@ module IncidentManagement
starts_at
,
ends_at
=
rotation
.
active_period
.
for_date
(
shift_cycle_starts_at
+
shift_count
.
days
)
shift_for
(
participant
,
starts_at
,
limit_end_time
(
ends_at
))
shift_for
(
participant
,
[
rotation
.
starts_at
,
starts_at
].
max
,
limit_end_time
(
ends_at
))
end
else
# This is the normal shift start/end times
...
...
ee/spec/lib/incident_management/oncall_shift_generator_spec.rb
View file @
40765c8d
...
...
@@ -146,6 +146,25 @@ RSpec.describe IncidentManagement::OncallShiftGenerator do
[
:participant2
,
'2020-12-20 08:00:00 UTC'
,
'2020-12-20 17:00:00 UTC'
],
[
:participant2
,
'2020-12-21 08:00:00 UTC'
,
'2020-12-21 17:00:00 UTC'
]]
end
context
'rotation start time is in middle of active period'
do
before
do
rotation
.
update!
(
starts_at:
rotation_start_time
.
change
(
hour:
10
))
end
it_behaves_like
'unsaved shifts'
,
'5 shifts for each participant split by each day'
,
[[
:participant1
,
'2020-12-08 10:00:00 UTC'
,
'2020-12-08 17:00:00 UTC'
],
[
:participant1
,
'2020-12-09 08:00:00 UTC'
,
'2020-12-09 17:00:00 UTC'
],
[
:participant1
,
'2020-12-10 08:00:00 UTC'
,
'2020-12-10 17:00:00 UTC'
],
[
:participant1
,
'2020-12-11 08:00:00 UTC'
,
'2020-12-11 17:00:00 UTC'
],
[
:participant1
,
'2020-12-12 08:00:00 UTC'
,
'2020-12-12 17:00:00 UTC'
],
[
:participant2
,
'2020-12-13 08:00:00 UTC'
,
'2020-12-13 17:00:00 UTC'
],
[
:participant2
,
'2020-12-14 08:00:00 UTC'
,
'2020-12-14 17:00:00 UTC'
],
[
:participant2
,
'2020-12-15 08:00:00 UTC'
,
'2020-12-15 17:00:00 UTC'
],
[
:participant2
,
'2020-12-16 08:00:00 UTC'
,
'2020-12-16 17:00:00 UTC'
],
[
:participant2
,
'2020-12-17 08:00:00 UTC'
,
'2020-12-17 17:00:00 UTC'
]]
end
end
context
'when end time is earlier than start time'
do
...
...
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