radiant-race_results-extension 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.2
1
+ 1.3.3
@@ -128,7 +128,9 @@ protected
128
128
  def process_results_file
129
129
  if csv_data = read_results_file
130
130
  headers = csv_data.shift.map(&:to_s)
131
- checkpoints = headers.map{|h| race.checkpoints.find_by_name(h) }.compact
131
+ Rails.logger.warn "!!! headers: #{headers.inspect}"
132
+ checkpoints = headers.map{|h| race.checkpoints.find_by_name(h.strip) }.compact
133
+ Rails.logger.warn "!!! checkpoints: #{checkpoints.inspect}"
132
134
  race_data = csv_data.map {|row| row.map {|cell| cell.to_s } }.map {|row| Hash[*headers.zip(row).flatten] } # build AoA and then hash the second level
133
135
  RaceInstance.transaction do
134
136
  performances.destroy_all
@@ -154,7 +156,7 @@ protected
154
156
 
155
157
  checkpoints.each do |cp|
156
158
  value = runner[normalize(cp.name)]
157
- cpt = performance.checkpoint_times.create!(:race_checkpoint_id => cp.id, :elapsed_time => value || 0)
159
+ cpt = performance.checkpoint_times.create!(:race_checkpoint_id => cp.id, :elapsed_time => value) unless value.blank?
158
160
  end
159
161
  end
160
162
  end
@@ -22,14 +22,12 @@
22
22
  = link_to "Races", races_url, :class => 'breadhead'
23
23
  = t('separator')
24
24
  = link_to @instance.race.name, race_url(@instance.race), :class => 'breadhead'
25
+ - if @club || @category
26
+ = t('separator')
27
+ = link_to @instance.name, race_instance_url(@instance.race, @instance), :class => 'breadhead'
25
28
 
26
29
  - content_for :title do
27
- - if @club
28
- = "#{@instance.full_name}: #{@club.name}"
29
- - elsif @category
30
- = "#{@instance.full_name}: #{@category.name}"
31
- - else
32
- = @instance.full_name
30
+ = @instance.full_name
33
31
 
34
32
  - content_for :introduction do
35
33
  - if @instance.past?
@@ -27,15 +27,10 @@
27
27
  = t('separator')
28
28
  = link_to @instance.race.name, race_url(@instance.race), :class => 'breadhead'
29
29
  = t('separator')
30
- splits
30
+ = link_to @instance.name, race_instance_url(@instance.race, @instance), :class => 'breadhead'
31
31
 
32
32
  - content_for :title do
33
- - if @club
34
- = "#{@instance.full_name}: #{@club.name} splits"
35
- - elsif @category
36
- = "#{@instance.full_name}: #{@category.name} splits"
37
- - else
38
- = "#{@instance.full_name}: splits"
33
+ = "#{@instance.full_name}: splits"
39
34
 
40
35
  - content_for :introduction do
41
36
  - if @instance.past?
@@ -3,19 +3,24 @@
3
3
  %tr{:class => trclass}
4
4
  %td.pos
5
5
  - if performance.finished?
6
- = link_to performance.position, race_performance_url(@instance.race, @instance, performance)
6
+ - if @instance.splits_available?
7
+ = link_to performance.position, race_performance_url(@instance.race, @instance, performance)
8
+ - else
9
+ = performance.position
7
10
  - else
8
11
  = performance.status
9
12
  %td.name
10
- = link_to performance.name, race_performance_url(@instance.race, @instance, performance)
13
+ - if @instance.splits_available?
14
+ = link_to performance.name, race_performance_url(@instance.race, @instance, performance)
15
+ - else
16
+ = performance.name
11
17
  %td.club
12
18
  - if performance.club
13
19
  = link_to_unless_current performance.club.name, race_club_url(@instance.race, @instance, performance.club)
14
20
  %td.cat
15
21
  = link_to_unless_current performance.race_category.name, race_category_url(@instance.race, @instance, performance.race_category)
16
22
  %td.time
17
- - if performance.finished?
18
- = performance.elapsed_time
23
+ = performance.elapsed_time
19
24
  %td.prizes
20
25
  - if performance.finished?
21
26
  = performance.prizes
@@ -9,9 +9,10 @@
9
9
  %td.runner
10
10
  = link_to performance.name, race_performance_url(@instance.race, @instance, performance)
11
11
  - previous = nil
12
+ - splits = @splits[performance.id] || []
12
13
  - @checkpoints.each do |cp|
13
14
  %td.cpt
14
- - if t = @splits[performance.id][cp.id]
15
+ - if t = splits[cp.id]
15
16
  = t
16
17
  - if previous
17
18
  %br
@@ -22,9 +23,8 @@
22
23
  - previous = nil
23
24
  —
24
25
  %td.time
25
- - if performance.finished?
26
- = performance.elapsed_time
27
- - if previous
28
- %br
29
- %span.note
30
- = performance.elapsed_time - previous
26
+ = performance.elapsed_time
27
+ - if previous
28
+ %br
29
+ %span.note
30
+ = performance.elapsed_time - previous
@@ -2,7 +2,7 @@
2
2
  # require_dependency 'application_controller'
3
3
 
4
4
  class RaceResultsExtension < Radiant::Extension
5
- version "1.3.2"
5
+ version "1.3.3"
6
6
  description "Makes easy the uploading, analysis and display of race results. Built for fell races but should work for most timed or score events."
7
7
  url "http://spanner.org/radiant/race_results"
8
8
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-race_results-extension}
8
- s.version = "1.3.2"
8
+ s.version = "1.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["spanner"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-race_results-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 2
10
- version: 1.3.2
9
+ - 3
10
+ version: 1.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - spanner