simple-trail 0.2.4 → 0.2.6

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: c68514bf45dc7a1fc4634824e82aa55a0aae93b1551dcd0b4627b8fe81e4cdb7
4
- data.tar.gz: fb790e381f48edf24b1fe03fafdaef9bc20ebffc6c4adc002501d4e04c9d42df
3
+ metadata.gz: d608b96acfb85c52f3fc307cd4e192323409b9751b0a9cc63a0186aba7e3e000
4
+ data.tar.gz: 4e93f997eb2729fc3bcb39e0d554febb6414e794fd7c8f5ebdfc4f53769687cc
5
5
  SHA512:
6
- metadata.gz: 38045830ba9d6449b43b9eea10bd6dd206b4f1d2279f9b81927fc604f0022be0f850c0299f5849f43520a8b54ef403abe4cace57863a978d5bfea4d2abaa69d9
7
- data.tar.gz: d29501cca5752bf6c0c1baa34ee8e6a3d9131ed54fc78a6171be209bc984c8fb08f3a6e4fca277a2f98a57174d2c6fdd397c609c3fad26f97f3520f10cf6246c
6
+ metadata.gz: 1f6d82618ceff0384f5b8238ab571831ba77ef69732a8761ad81e53050c02195349a400259bec1a86f6491a26e0d9ef33b01af5c991193e0956a56cdd10b9bc0
7
+ data.tar.gz: 98789cedfb83d67f74c11646d021bc2087480ad26a9047f32b45aad271491ca8142cab1540a771ca1540f8905041d91fd722bb75e8dcb4c00f433dfee765dfdd
@@ -75,17 +75,18 @@ module Manipulation
75
75
  end
76
76
 
77
77
  def add_km_markers
78
- total_distance = @points[-1][:total_distance].floor - 1
78
+ total_distance = @points[-1][:total_distance].floor
79
79
  start_v = @offset.to_f.ceil
80
80
 
81
81
  (start_v..start_v+total_distance).each do |i|
82
- find_and_enrich_first_occurence(i+1)
82
+ next if i == @offset.to_f
83
+ find_and_enrich_first_occurence(i)
83
84
  end
84
85
  end
85
86
 
86
87
  def find_and_enrich_first_occurence(i)
87
88
  index = @points.find_index{|point| point[:total_distance] + @offset.to_f > i}
88
- @points[index].merge!(label: i)
89
+ @points[index].merge!(label: i) if index
89
90
  end
90
91
 
91
92
  def calculate_distance(loc1, loc2)
data/simple-trail.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'simple-trail'
8
- s.version = '0.2.4'
8
+ s.version = '0.2.6'
9
9
  s.date = '2020-08-03'
10
10
  s.summary = 'Readind and manipulating GPX and other trail representation file'
11
11
  s.description = 'Optimazing and manipulating GPX file data. For my private purposes mostly'
@@ -47,6 +47,8 @@ RSpec.describe Manipulation::Enricher do
47
47
  labels = enrichement_logic.enriched_points.map{|h| h[:label]}.compact.uniq
48
48
  expect(labels.size).to eq 506
49
49
  expect(labels.include?(1)).to be(true)
50
+ expect(labels.include?(506)).to be(true)
51
+ expect(labels.include?(507)).to be(false)
50
52
  expect(labels.include?(535)).to be(false)
51
53
  end
52
54
 
@@ -59,6 +61,8 @@ RSpec.describe Manipulation::Enricher do
59
61
  labels = enrichement_logic.enriched_points.map{|h| h[:label]}.compact.uniq
60
62
  expect(labels.size).to eq 506
61
63
  expect(labels.include?(1)).to be(false)
62
- expect(labels.include?(535)).to be(true)
64
+ expect(labels.include?(50)).to be(false)
65
+ expect(labels.include?(51)).to be(true)
66
+ expect(labels.include?(556)).to be(true)
63
67
  end
64
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Staszek Zawadzki
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.1.4
147
+ rubygems_version: 3.3.7
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Readind and manipulating GPX and other trail representation file