Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Last tweaks I'd made. Commit for reference
I'd forgotten to commit these. Committing for reference since none of this |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | old-smile-site |
Files: | files | file ages | folders |
SHA1: |
ce95ff0dde6a73b8020bbdda1ea9280f |
User & Date: | atomicules 2016-09-04 14:15:22 |
2016-10-02
| ||
12:30 |
Convert to csv parsing only
Really I don't need all that class stuff in there anymore, but I thought I | |
2016-09-04
| ||
14:15 |
Last tweaks I'd made. Commit for reference
I'd forgotten to commit these. Committing for reference since none of this | |
2016-01-06
| ||
13:27 |
Fix for negative balances
Sob. Sob. Not that I ever want to see them though. I'd inadvertently assumed I'd only ever see a positive balance. Need to regexp | |
Changes to smile.rb.
︙ | ︙ | |||
108 109 110 111 112 113 114 | page = @a.click(page.link_with(:text => "previous statement page")) end end def get_transactions(page) doc = Nokogiri::HTML(page.body) | | | | > > > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | page = @a.click(page.link_with(:text => "previous statement page")) end end def get_transactions(page) doc = Nokogiri::HTML(page.body) #Look for summaryTable, sometimes can be two, get the last rows = doc.xpath("//table[@class='summaryTable'][position()=last()]//tr") #Skip first row (table headers, ths) rows = rows[1..-1] transactions = [] rows.each do |row| #Skip last row, maybe #Also, sometimes bugs or invalid markup and so even though last row does have just one td doesn't get reported that way #So use begin/rescue begin #Might as well parse date here date = Date.parse(row.elements[0].text.strip) name = row.elements[1].text.strip credit = row.elements[2].text.strip debit = row.elements[3].text.strip unless name.include?("BROUGHT FORWARD") transactions << { :date => date, :name => name, :credit => credit, :debit => debit} end rescue end end #Sort in order of newest date first so can add on @transactions += transactions.sort { | t1, t2 | t2[:date] <=> t1[:date] } end |
︙ | ︙ |