Class: ODDB::FachinfoInvoicer

Inherits:
InfoInvoicer show all
Defined in:
src/plugin/fachinfo_invoicer.rb

Constant Summary

Constants inherited from Invoicer

RECIPIENTS

Constants inherited from Plugin

ARCHIVE_PATH, RECIPIENTS

Instance Method Summary (collapse)

Methods inherited from InfoInvoicer

#active_companies, #adjust_annual_fee, #adjust_company_fee, #adjust_overlap_fee, #all_items, #annual_items, #filter_paid, #group_by_company, #html_items, #neighborhood_unique_names, #pointer_resolved, #recent_items, #send_annual_invoices, #send_daily_invoices, #slate_items

Methods inherited from Invoicer

#create_invoice, #ensure_yus_user, #resend_invoice, #rp2fr, #send_invoice

Methods inherited from Plugin

#l10n_sessions, #log_info, #recipients, #resolve_link, #update_rss_feeds

Methods included from HttpFile

#http_body, #http_file

Constructor Details

- (FachinfoInvoicer) initialize(*args)

A new instance of FachinfoInvoicer



8
9
10
11
12
# File 'src/plugin/fachinfo_invoicer.rb', line 8

def initialize(*args)
  @infotype = :fachinfo
  @companies = {}
  super
end

Instance Method Details

- (Object) activation_fee



13
14
15
# File 'src/plugin/fachinfo_invoicer.rb', line 13

def activation_fee
  FI_UPLOAD_PRICES[:activation]
end

- (Object) active_infos



16
17
18
# File 'src/plugin/fachinfo_invoicer.rb', line 16

def active_infos
  @app.active_fachinfos
end

- (Object) parent_item_class



19
20
21
# File 'src/plugin/fachinfo_invoicer.rb', line 19

def parent_item_class
  Registration
end

- (Object) report



40
41
42
43
44
45
46
47
48
49
50
51
# File 'src/plugin/fachinfo_invoicer.rb', line 40

def report
  report = super
  @companies.sort.each { |company_name, fachinfos|
    report << company_name << "\n"
    fachinfos.sort_by { |fi| fi.name_base }.each { |fi|
      report << sprintf("%s:\n  http://www.oddb.org/de/gcc/resolve/pointer/%s\n",
                    fi.name_base, fi.pointer) 
    }
    report << "\n"
  }
  !report.empty? && report
end

- (Object) report_edited_fachinfos(day1)



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'src/plugin/fachinfo_invoicer.rb', line 26

def report_edited_fachinfos(day1)
  day2 = day1 + 1
  time1 = Time.local(day1.year, day1.month, day1.day)
  time2 = Time.local(day2.year, day2.month, day2.day)
  range = (time1...time2)
  modified = @app.fachinfos.values.select { |fi| 
    fi.change_log.reverse.any? { |item|
      range.include?(item.time)
    }
  }
  modified.each { |fi|
    (@companies[fi.company_name] ||= []).push(fi)
  }
end

- (Object) run(day = @@today)



22
23
24
25
# File 'src/plugin/fachinfo_invoicer.rb', line 22

def run(day = @@today)
  report_edited_fachinfos(day - 1)
  super
end

- (Object) unique_name(item)



52
53
54
# File 'src/plugin/fachinfo_invoicer.rb', line 52

def unique_name(item)
  item.item_pointer
end