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
8289f62f
Commit
8289f62f
authored
Mar 29, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move end date calculation to ActivePeriod class
- Minor spec tidy up
parent
9fc605a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
ee/app/models/incident_management/oncall_rotation.rb
ee/app/models/incident_management/oncall_rotation.rb
+3
-1
ee/lib/incident_management/oncall_shift_generator.rb
ee/lib/incident_management/oncall_shift_generator.rb
+2
-4
ee/spec/requests/api/issues_spec.rb
ee/spec/requests/api/issues_spec.rb
+1
-1
ee/spec/support/helpers/oncall_helpers.rb
ee/spec/support/helpers/oncall_helpers.rb
+1
-1
No files found.
ee/app/models/incident_management/oncall_rotation.rb
View file @
8289f62f
...
...
@@ -11,7 +11,9 @@ module IncidentManagement
end_time
>
start_time
if
present?
end
def
for_dates
(
start_date
,
end_date
)
def
for_date
(
start_date
)
end_date
=
end_after_start?
?
start_date
:
start_date
.
next_day
[
start_date
.
change
(
hour:
start_time
.
hour
,
min:
start_time
.
min
),
end_date
.
change
(
hour:
end_time
.
hour
,
min:
end_time
.
min
)
...
...
ee/lib/incident_management/oncall_shift_generator.rb
View file @
8289f62f
...
...
@@ -129,10 +129,8 @@ module IncidentManagement
# expected_shift_count = 14 -> pretend it's a 2-week rotation
# shift_count = 2 -> we're calculating the shift for the 3rd day
# starts_at = Monday 00:00:00 + 8.hours + 2.days => Thursday 08:00:00
start_date
=
end_date
=
shift_cycle_starts_at
+
shift_count
.
days
end_date
=
start_date
+
1
.
day
unless
rotation
.
active_period
.
end_after_start?
starts_at
,
ends_at
=
rotation
.
active_period
.
for_dates
(
start_date
,
end_date
)
start_date
=
shift_cycle_starts_at
+
shift_count
.
days
starts_at
,
ends_at
=
rotation
.
active_period
.
for_date
(
start_date
)
shift_for
(
participant
,
[
rotation
.
starts_at
,
starts_at
].
max
,
limit_end_time
(
ends_at
))
end
...
...
ee/spec/requests/api/issues_spec.rb
View file @
8289f62f
...
...
@@ -10,7 +10,7 @@ RSpec.describe API::Issues, :mailer do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:epic
)
{
create
(
:epic
,
group:
group
)
}
let_it_be
(
:group_project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
group
)
}
let_it_be
(
:group_project
)
{
create
(
:project
,
:public
,
creator_id:
user
.
id
,
namespace:
group
)
}
let
(
:user2
)
{
create
(
:user
)
}
...
...
ee/spec/support/helpers/oncall_helpers.rb
View file @
8289f62f
...
...
@@ -4,6 +4,6 @@ module OncallHelpers
def
active_period_for_date_with_tz
(
date
,
rotation
)
date
=
date
.
in_time_zone
(
rotation
.
schedule
.
timezone
)
rotation
.
active_period
.
for_date
s
(
date
,
date
)
rotation
.
active_period
.
for_date
(
date
)
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