Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
/home/masa/ywesee/oddb.org/src/plugin/patinfo_invoicer.rb | 76 | 72 | 43.42%
|
40.28%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 #!/usr/bin/env ruby |
2 # PatinfoInvoicer -- oddb -- 16.08.2005 -- jlang@ywesee.com |
3 |
4 require 'plugin/info_invoicer' |
5 |
6 module ODDB |
7 class PatinfoInvoicer < InfoInvoicer |
8 def initialize(*args) |
9 @infotype = :patinfo |
10 super |
11 end |
12 def activation_fee |
13 PI_UPLOAD_PRICES[:activation] |
14 end |
15 def active_infos |
16 @app.active_pdf_patinfos.keys.inject({}) { |inj, key| |
17 inj.store(key[0,8], 1) |
18 inj |
19 } |
20 end |
21 def html_items(first) |
22 invoiced = {} |
23 items = [] |
24 last = first >> 12 |
25 @app.companies.each_value { |company| |
26 if(company.invoice_htmlinfos && company.invoice_date(:patinfo) == first) |
27 company.registrations.each { |reg| |
28 if(reg.active?) |
29 reg.each_sequence { |seq| |
30 if(seq.public_package_count > 0 && !seq.pdf_patinfo \ |
31 && (patinfo = seq.patinfo.odba_instance) \ |
32 && !invoiced.include?(patinfo)) |
33 invoiced.store(patinfo, true) |
34 item = AbstractInvoiceItem.new |
35 item.price = PI_UPLOAD_PRICES[:annual_fee] |
36 item.text = [reg.iksnr, seq.seqnr].join(' ') |
37 item.time = Time.now |
38 item.type = :annual_fee |
39 item.unit = "Jahresgeb\374hr" |
40 item.vat_rate = VAT_RATE |
41 item.item_pointer = seq.pointer |
42 items.push(item) |
43 end |
44 } |
45 end |
46 } |
47 end |
48 } |
49 items |
50 end |
51 def neighborhood_unique_names(item) |
52 names = [unique_name(item)].compact |
53 if((ptr = item.item_pointer) && (seq = ptr.resolve(@app))) |
54 active = seq.pdf_patinfo |
55 seq.registration.sequences.each_value { |other| |
56 if(other.pdf_patinfo == active) |
57 names.push([other.iksnr, other.seqnr].join('_')) |
58 end |
59 } |
60 end |
61 names.uniq |
62 end |
63 def parent_item_class |
64 Sequence |
65 end |
66 def unique_name(item) |
67 name = item.text |
68 if(/^[0-9]{5} [0-9]{2}$/u.match(name)) |
69 name.tr(' ', '_') |
70 elsif((ptr = item.item_pointer) && (seq = ptr.resolve(@app)) \ |
71 && seq.is_a?(Sequence)) |
72 [seq.iksnr, seq.seqnr].join('_') |
73 end |
74 end |
75 end |
76 end |
Generated on Fri Feb 25 07:43:28 +0100 2011 with rcov 0.9.8