Commit 16f0516f authored by Sean Arnold's avatar Sean Arnold

Return active times in HH:MM format

parent aeea7a72
...@@ -9,13 +9,19 @@ module Types ...@@ -9,13 +9,19 @@ module Types
field :from, GraphQL::STRING_TYPE, field :from, GraphQL::STRING_TYPE,
null: true, null: true,
description: 'The start of the rotation interval.', description: 'The start of the rotation interval.'
method: :start_time
field :to, GraphQL::STRING_TYPE, field :to, GraphQL::STRING_TYPE,
null: true, null: true,
description: 'The end of the rotation interval.', description: 'The end of the rotation interval.'
method: :end_time
def from
object.start_time&.strftime('%H:%M')
end
def to
object.end_time&.strftime('%H:%M')
end
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
end end
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module IncidentManagement module IncidentManagement
class OncallRotation < ApplicationRecord class OncallRotation < ApplicationRecord
include Gitlab::Utils::StrongMemoize
ActivePeriod = Struct.new(:start_time, :end_time) do ActivePeriod = Struct.new(:start_time, :end_time) do
def present? def present?
start_time && end_time start_time && end_time
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment