aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/clean_up_result.rb
blob: 9151decaf78e26e4a2a1a161ca8b93f045af30cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class CleanUpResult
  include ActiveModel::Conversion  
  extend ActiveModel::Naming
  
  attr_accessor :time_table_count,:vehicle_journey_count,:journey_pattern_count,:route_count,:line_count
  attr_accessor :stop_count,:company_count,:network_count
  
  def initialize()
    self.time_table_count = 0
    self.vehicle_journey_count = 0
    self.journey_pattern_count = 0
    self.route_count = 0
    self.line_count = 0
    self.stop_count = 0
    self.company_count = 0
    self.network_count = 0
  end  
    
  def persisted?  
    false  
  end 

  def notice
    a = Array.new
    a << I18n.t('clean_ups.success_tm', :count => time_table_count.to_s)
    if (vehicle_journey_count > 0) 
      a << I18n.t('clean_ups.success_vj', :count => vehicle_journey_count.to_s)
    end   
    if (journey_pattern_count > 0) 
      a << I18n.t('clean_ups.success_jp', :count => journey_pattern_count.to_s)
    end   
    if (route_count > 0) 
      a << I18n.t('clean_ups.success_r', :count => route_count.to_s)
    end   
    if (line_count > 0) 
      a << I18n.t('clean_ups.success_l', :count => line_count.to_s)
    end   
    if (company_count > 0) 
      a << I18n.t('clean_ups.success_c', :count => company_count.to_s)
    end   
    if (network_count > 0) 
      a << I18n.t('clean_ups.success_n', :count => network_count.to_s)
    end   
    if (stop_count > 0) 
      a << I18n.t('clean_ups.success_sa', :count => stop_count.to_s)
    end 
    a  

  end
  
end