opening_hours_converter 1.3.4 → 1.3.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
  SHA1:
3
- metadata.gz: 77877de8c8f968fb38333ec2651d5b86ce53730d
4
- data.tar.gz: 70bf8740c347b513d25a6195fc8560b1f16e2231
3
+ metadata.gz: f7d37b252319e4c869b7ea7aa6cee44813c745d3
4
+ data.tar.gz: 286e05c551c3ecd6faff2515c24815262c50f2e2
5
5
  SHA512:
6
- metadata.gz: 33f8585ab06fed03c13e5713fb501de2d8db6044a923b87fed19c59f8e9ae981baa08faf1a5ab958f6759a05e1303df51a33f5bbad0a67229c7f3154d816a7df
7
- data.tar.gz: 44e96458e25695a50fdadec9b8002c2dbce0b7413fad91dba751008560bf68ca4e927aa81930ca4771d5e859a60e95fbdf7c565bcc2f9090af34fd47e75f9045
6
+ metadata.gz: 054a05d8fb67787c2648bffa37e05cd7f92602c74901bc3cd92e5324b2120fb04dddeb4eb9521f68b6cb743f26c48e56c3142ca631a1ebbf4626952f817f0a1d
7
+ data.tar.gz: fb9d52a16a98d97063d236d912d825eae78649b13c337cbe1512926e9ccb9447724ef62f7489100036b3a74270f363ff769853bcc8aa47c80323720668ef4680
@@ -1,5 +1,5 @@
1
1
  require 'opening_hours_converter/constants'
2
-
2
+ require 'pry-nav'
3
3
  module OpeningHoursConverter
4
4
  class OpeningHoursBuilder
5
5
  include Constants
@@ -107,11 +107,21 @@ module OpeningHoursConverter
107
107
  end
108
108
 
109
109
  result = ""
110
- rules.each_with_index do |rule, rule_index|
111
- if rule_index > 0
112
- result += "; "
110
+ if rules.length == 0
111
+
112
+ date_ranges.each do |dr|
113
+ if dr.wide_interval.type != "always"
114
+ result += "#{dr.wide_interval.get_time_selector} off"
115
+ end
116
+ end
117
+
118
+ else
119
+ rules.each_with_index do |rule, rule_index|
120
+ if rule_index > 0
121
+ result += "; "
122
+ end
123
+ result += rule.get
113
124
  end
114
- result += rule.get
115
125
  end
116
126
 
117
127
  return result
@@ -24,7 +24,7 @@ module OpeningHoursConverter
24
24
  result = []
25
25
  blocks = oh.split(';')
26
26
 
27
- comment = nil
27
+ comment = ""
28
28
  rule_modifier = nil
29
29
  time_selector = nil
30
30
  weekday_selector = nil
@@ -193,6 +193,7 @@ module OpeningHoursConverter
193
193
  res_dr_id = 0
194
194
 
195
195
  while res_dr_id < result.length && !found_date_range
196
+ # binding.pry
196
197
  if result[res_dr_id].wide_interval.equals(dr) && result[res_dr_id].comment == comment
197
198
  found_date_range = true
198
199
  else
@@ -248,6 +249,7 @@ module OpeningHoursConverter
248
249
 
249
250
  for t_id in 0...times.length
250
251
  if rule_modifier == "closed" || rule_modifier == "off"
252
+ # binding.pry
251
253
  remove_interval(dr_obj.typical, weekdays[wd_id], times[t_id])
252
254
  else
253
255
  add_interval(dr_obj.typical, weekdays[wd_id], times[t_id])
@@ -256,6 +258,7 @@ module OpeningHoursConverter
256
258
  end
257
259
  end
258
260
  end
261
+ # binding.pry
259
262
 
260
263
  return result
261
264
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opening_hours_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ziserman Martin