Class: ODDB::State::Admin::PatinfoStatsCommon::CompanyFacade

Inherits:
Object
  • Object
show all
Defined in:
src/state/admin/patinfo_stats.rb

Instance Method Summary (collapse)

Constructor Details

- (CompanyFacade) initialize(company)

A new instance of CompanyFacade



48
49
50
51
# File 'src/state/admin/patinfo_stats.rb', line 48

def initialize(company)
  @company = company
  @slate_sequences= {}
end

Instance Method Details

- (Object) add_sequence(item_facade)



52
53
54
55
56
57
58
59
# File 'src/state/admin/patinfo_stats.rb', line 52

def add_sequence(item_facade)
  sequence = item_facade.sequence
  sequence_facade = @slate_sequences.fetch(sequence) {
    @slate_sequences.store(sequence, 
      SequenceFacade.new(sequence))
  }
  sequence_facade.add_invoice_item(item_facade)
end

- (Object) name



68
69
70
# File 'src/state/admin/patinfo_stats.rb', line 68

def name
  @company.name
end

- (Object) newest_date



71
72
73
74
75
# File 'src/state/admin/patinfo_stats.rb', line 71

def newest_date
  @slate_sequences.values.collect { |seq| 
    seq.newest_date 
  }.max
end

- (Object) pointer



76
77
78
# File 'src/state/admin/patinfo_stats.rb', line 76

def pointer
  @company.pointer
end

- (Object) slate_count



65
66
67
# File 'src/state/admin/patinfo_stats.rb', line 65

def slate_count
  @slate_sequences.size
end

- (Object) slate_sequences



60
61
62
63
64
# File 'src/state/admin/patinfo_stats.rb', line 60

def slate_sequences
  @slate_sequences.values.sort_by { |seq|
    seq.newest_date
  }.reverse
end

- (Object) user



79
80
81
# File 'src/state/admin/patinfo_stats.rb', line 79

def user
  @company.user
end