Class: SimulatorChampionship

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/simulator_championship.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dump!Object



24
25
26
27
28
29
# File 'app/models/simulator_championship.rb', line 24

def self.dump!
  FootStats::Championship.all.each do |foot_stats_championship|
    championship = self.find_or_create_by_source_id foot_stats_championship.source_id
    championship.update_attributes foot_stats_championship.attributes
  end
end

.to_foot_statsObject



20
21
22
# File 'app/models/simulator_championship.rb', line 20

def self.to_foot_stats
  { 'Campeonato' => all.map(&:to_foot_stats) }
end

Instance Method Details

#classificationObject



6
7
8
# File 'app/models/simulator_championship.rb', line 6

def classification
  @classification ||= SimulatorClassification.new(self)
end

#to_foot_statsObject



10
11
12
13
14
15
16
17
18
# File 'app/models/simulator_championship.rb', line 10

def to_foot_stats
  {
    '@Id'               => self.source_id.to_s,
    '@Nome'             => self.name,
    '@TemClassificacao' => (self.has_classification ? 'True' : 'False'),
    '@RodadaATual'      => self.current_round.to_s,
    '@Rodadas'          => self.total_rounds.to_s
  }
end