concept2-data-parser 0.1.0 → 0.1.1

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: 1879f7982a7337c27edd455ba39c1353fb66e51b
4
- data.tar.gz: 128deb1c4762a504c9835ad509510327cd11421e
3
+ metadata.gz: a29779059a390831997f8bf586fb6f006b18321b
4
+ data.tar.gz: 363f5ffc5f8c110ef061836206ed7c14eab0923e
5
5
  SHA512:
6
- metadata.gz: bfbf3711c132ff290986a2d7fb969288b67de0905dcd0b2168f39160a96b3e70d5dcf822398ab7d7fa10881c6b55e12e80e15152cb7c1496adacbf15ef2c69d3
7
- data.tar.gz: 412d8a438df5ee7ae04f6dc8a76d17bbb9f85ed80b64f661018fc7b709d5535a0f9779e98ceba26282c726296dcf40c1a4e1f7228435f8030c99218a6619ff0f
6
+ metadata.gz: d740829466bb91eb29da27bd65a463e175f77be432720906a6fabadb83244e2814631a105bcb66dd780405cb8ba5ea6ccb6c37f255dae82007d0230e35058f7b
7
+ data.tar.gz: 3873ec8c7b5680b59f0dd348ab35ab2e3220dc1156cc934a773f69d24cf98d436899e356530744dcf121cc2d3611798aec4c80f891cebf4b15fd5498c0161e1f
data/README.md CHANGED
@@ -10,7 +10,7 @@ Install it yourself as:
10
10
 
11
11
  ## Usage
12
12
 
13
- TODO: Write usage instructions here
13
+ $ concept2-parser <stroke-data-file.txt>
14
14
 
15
15
  ## Development
16
16
 
@@ -58,8 +58,8 @@ module Concept2
58
58
 
59
59
  def compile_totals!
60
60
  @rowers.each do |rower|
61
- rower[:overall_time] = ChronicDuration.output(
62
- rower[:data].last[0].round(1), format: :chrono)
61
+ rower[:overall_time] = normalize_duration(ChronicDuration.output(
62
+ rower[:data].last[0].round(1), format: :chrono))
63
63
  rower[:overall_stroke_rate] = average_stroke_rate(
64
64
  rower[:data].map {|n| n[2] })
65
65
  rower[:overall_split] = split_time(rower[:data].last[0], 6000.0)
@@ -96,10 +96,15 @@ module Concept2
96
96
  end
97
97
 
98
98
  def split_time(secs, distance=500.0)
99
- ChronicDuration.output(
100
- ((secs * 500.0) / distance).round(1), format: :chrono)
99
+ normalize_duration(ChronicDuration.output(
100
+ ((secs * 500.0) / distance).round(1), format: :chrono))
101
101
  end
102
102
 
103
+ # Adds a decimal place so that spreadsheets distinguish hours/minutes
104
+ def normalize_duration(duration)
105
+ duration = "#{duration}.0" unless duration =~ /\..+$/
106
+ duration
107
+ end
103
108
 
104
109
  end
105
110
  end
@@ -1,7 +1,8 @@
1
1
  module Concept2
2
2
  module Data
3
3
  class Parser
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
8
+
@@ -27,7 +27,7 @@ class Concept2DataParserTest < Minitest::Test
27
27
  end
28
28
 
29
29
  it "compiles the overall time" do
30
- assert_equal ["26:17.5", "26:15", "27:00.9", "25:52"],
30
+ assert_equal ["26:17.5", "26:15.0", "27:00.9", "25:52.0"],
31
31
  @parser.rowers.map {|r| r[:overall_time] }
32
32
  end
33
33
 
@@ -47,7 +47,7 @@ class Concept2DataParserTest < Minitest::Test
47
47
  end
48
48
 
49
49
  it "compiles 500m splits" do
50
- assert_equal ["2:03.5", "2:12.5", "2:14", "2:15", "2:15", "2:14.5", "2:13", "2:14", "2:10", "2:10.4", "2:10.5", "2:04.6"],
50
+ assert_equal ["2:03.5", "2:12.5", "2:14.0", "2:15.0", "2:15.0", "2:14.5", "2:13.0", "2:14.0", "2:10.0", "2:10.4", "2:10.5", "2:04.6"],
51
51
  @parser.rowers[0][:splits]
52
52
  end
53
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concept2-data-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Poydar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic_duration