Sha256: 962c91f2e2c2c3973b67c416d9aad52ebf2f1c04bbb3f28bb27ff3ff45442549

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

class RaceInstancesController < SiteController
  radiant_layout { |controller| Radiant::Config['races.layout'] }
  no_login_required
  before_filter :establish_context

  def show
    expires_in 1.month, :private => false, :public => true
    respond_to do |format|
      format.html {}
      format.csv {}
      format.json { render :json => @performances.completed }
    end
  end

  def splits
    expires_in 1.month, :private => false, :public => true
    @checkpoints = @instance.checkpoints
    @splits = @instance.assembled_checkpoint_times
  end

private

  def establish_context
    @race = Race.find_by_slug(params[:race_slug])
    @instance = @race.instances.find_by_slug(params[:slug])
    @performances = @instance.performances
    if params[:club] && @club = RaceClub.find(params[:club])
      @performances = @performances.by_members_of(@club)
    end
    if params[:cat] && @category = @instance.categories.find_by_name(params[:cat])
      @performances = @performances.eligible_for_category(@category)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-race_results-extension-1.4.6 app/controllers/race_instances_controller.rb
radiant-race_results-extension-1.4.5 app/controllers/race_instances_controller.rb