Merge pull request #2915 from MathiusD/RefreshChannelsJob-frenquency

Allow configuration of the time between 2 RefreshChannelsJob
This commit is contained in:
Samantaz Fox
2022-02-25 00:04:48 +01:00
committed by GitHub
5 changed files with 98 additions and 29 deletions

View File

@@ -51,6 +51,24 @@ def recode_length_seconds(time)
end
end
def decode_interval(string : String) : Time::Span
rawMinutes = string.try &.to_i32?
if !rawMinutes
hours = /(?<hours>\d+)h/.match(string).try &.["hours"].try &.to_i32
hours ||= 0
minutes = /(?<minutes>\d+)m(?!s)/.match(string).try &.["minutes"].try &.to_i32
minutes ||= 0
time = Time::Span.new(hours: hours, minutes: minutes)
else
time = Time::Span.new(minutes: rawMinutes)
end
return time
end
def decode_time(string)
time = string.try &.to_f?