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
50635e9e
Commit
50635e9e
authored
Mar 31, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix convert timezone time
- We needed to ensure we convert at todays date
parent
72525fce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
ee/app/services/incident_management/oncall_schedules/update_service.rb
...es/incident_management/oncall_schedules/update_service.rb
+8
-4
ee/spec/services/incident_management/oncall_schedules/update_service_spec.rb
...cident_management/oncall_schedules/update_service_spec.rb
+4
-3
No files found.
ee/app/services/incident_management/oncall_schedules/update_service.rb
View file @
50635e9e
...
...
@@ -41,8 +41,8 @@ module IncidentManagement
rotation
,
user
,
{
active_period_start:
new_rotation_active_period
(
rotation
.
active_period_start
)
.
strftime
(
'%H:%M'
)
,
active_period_end:
new_rotation_active_period
(
rotation
.
active_period_end
)
.
strftime
(
'%H:%M'
)
active_period_start:
new_rotation_active_period
(
rotation
.
active_period_start
),
active_period_end:
new_rotation_active_period
(
rotation
.
active_period_end
)
}
)
...
...
@@ -52,8 +52,12 @@ module IncidentManagement
end
end
def
new_rotation_active_period
(
time_string
)
time_string
.
in_time_zone
(
original_schedule_timezone
).
in_time_zone
(
oncall_schedule
.
timezone
)
def
new_rotation_active_period
(
existing_time
)
existing_timezone_time
=
Time
.
find_zone!
(
original_schedule_timezone
)
.
now
.
change
(
hour:
existing_time
.
hour
,
min:
existing_time
.
min
)
existing_timezone_time
.
in_time_zone
(
oncall_schedule
.
timezone
).
strftime
(
'%H:%M'
)
end
def
error_no_permissions
...
...
ee/spec/services/incident_management/oncall_schedules/update_service_spec.rb
View file @
50635e9e
...
...
@@ -6,7 +6,7 @@ RSpec.describe IncidentManagement::OncallSchedules::UpdateService do
let_it_be
(
:user_with_permissions
)
{
create
(
:user
)
}
let_it_be
(
:user_without_permissions
)
{
create
(
:user
)
}
let_it_be_with_refind
(
:project
)
{
create
(
:project
)
}
let_it_be_with_reload
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
project:
project
)
}
let_it_be_with_reload
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_schedule
,
:utc
,
project:
project
)
}
let
(
:current_user
)
{
user_with_permissions
}
let
(
:params
)
{
{
name:
'Updated name'
,
description:
'Updated description'
,
timezone:
'America/New_York'
}
}
...
...
@@ -81,9 +81,10 @@ RSpec.describe IncidentManagement::OncallSchedules::UpdateService do
let_it_be_with_reload
(
:oncall_rotation
)
{
create
(
:incident_management_oncall_rotation
,
:with_active_period
,
schedule:
oncall_schedule
)
}
# This expects the active periods are updated according to the date above (22nd March, 2021 in the new timezone).
it
'updates the rotation active periods with new timezone'
do
expect
{
execute
}.
to
change
{
time_from_time_column
(
oncall_rotation
.
reload
.
active_period_start
)
}.
from
(
'08:00'
).
to
(
'0
3
:00'
)
.
and
change
{
time_from_time_column
(
oncall_rotation
.
active_period_end
)
}.
from
(
'17:00'
).
to
(
'1
2
:00'
)
expect
{
execute
}.
to
change
{
time_from_time_column
(
oncall_rotation
.
reload
.
active_period_start
)
}.
from
(
'08:00'
).
to
(
'0
4
:00'
)
.
and
change
{
time_from_time_column
(
oncall_rotation
.
active_period_end
)
}.
from
(
'17:00'
).
to
(
'1
3
:00'
)
end
context
'error updating'
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