opening_hours_converter 1.13.4 → 1.13.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3aa4f100c0d94af234e082bb2bb80b023ae5abff4a1a6931243f8bd038c722c
4
- data.tar.gz: 85e5efa4f22f7d9415a0f7f823a0cb1295d4b73e2949972d2a244c732f936b26
3
+ metadata.gz: f54fd5ddf40e3463f208523f3e4df1583a28157b1b4102c5c972e44b45f6789c
4
+ data.tar.gz: 63e8c1117bd05c79e58144815c89235f0ec8088b817a78e45f25feaf62dcf0f3
5
5
  SHA512:
6
- metadata.gz: 1e59e894e699683857bdc242bb3d9225d94272ab23b97566a182f5278aff04a447b7a608a6bc5fd78bb25b9a0eb3d990d036361b3da9aa9208dfb67a741768eb
7
- data.tar.gz: 2dda598800d025afe4a40363487efb07e6635cb5aebbd09b06640f7f24541619b2f5a02d24865f0bd7b2aa1235b27f9f7a9838e556aa87c405afbde212a5539d
6
+ metadata.gz: 8a4ad268e1c8c0f8e2e12bcf8b523eab79c59a910b41ce2c1c6c7f052359b34e9ecee1f63c541191104bd605a2efafc9637e9169804e5046b92339d14d623f18
7
+ data.tar.gz: 26114741c15bc0f79f9722526e7f2acbb91fa9baecb00d8bbf9b4b90a03d8b6a2dd956937bc4b989f27273c4142afa1351fef338a26bb7f63db4db9cdf0d7025
@@ -24,6 +24,7 @@ module OpeningHoursConverter
24
24
  years = process_always_holiday(date_range.wide_interval, years)
25
25
  end
26
26
  end
27
+
27
28
  if !date_range.wide_interval.start.nil? && !date_range.wide_interval.start[:year].nil?
28
29
  if date_range.wide_interval.end.nil? || date_range.wide_interval.end[:year].nil? || date_range.wide_interval.start[:year] == date_range.wide_interval.end[:year]
29
30
  if !years[date_range.wide_interval.start[:year]].nil?
@@ -227,7 +228,15 @@ module OpeningHoursConverter
227
228
  end
228
229
  else
229
230
  for year in (DateTime.now.year)..(DateTime.now.year + 1)
230
- if wide_interval.start.nil?
231
+ if wide_interval.type == 'week'
232
+ years[year] ||= Array.new(OSM_MONTHS.length) { |i| Array.new(MONTH_END_DAY[i]) { false } }
233
+ wide_interval.indexes.each do |week_index|
234
+ interval = WeekIndex.week_from_index(week_index, year)
235
+ (interval[:from]..interval[:to]).each do |day|
236
+ years[year][day.month - 1][day.day - 1] = true
237
+ end
238
+ end
239
+ elsif wide_interval.start.nil?
231
240
  years[year] = Array.new(OSM_MONTHS.length) { |i| Array.new(MONTH_END_DAY[i]) { true } }
232
241
  elsif !wide_interval.start[:day].nil?
233
242
  years[year] ||= Array.new(OSM_MONTHS.length) { |i| Array.new(MONTH_END_DAY[i]) { false } }
@@ -362,6 +371,14 @@ module OpeningHoursConverter
362
371
  end
363
372
  end
364
373
  end
374
+ elsif wide_interval.type == "week"
375
+ year = wide_interval.start&.dig(:year) || Time.now.year # can't process weeks with undefined year
376
+ wide_interval.indexes.each do |week_index|
377
+ interval = WeekIndex.week_from_index(week_index, year)
378
+ (interval[:from]..interval[:to]).each do |day|
379
+ years[year][day.month - 1][day.day - 1] = true
380
+ end
381
+ end
365
382
  elsif wide_interval.type == "day"
366
383
  if wide_interval.end.nil? || !wide_interval.end.nil? && wide_interval.start[:month] == wide_interval.end[:month]
367
384
  if wide_interval.end.nil? || !wide_interval.end.nil? && wide_interval.start[:day] == wide_interval.end[:day]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opening_hours_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.4
4
+ version: 1.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziserman Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json