Skip to content

Commit

Permalink
warn about empty Term data
Browse files Browse the repository at this point in the history
  • Loading branch information
tmtmtmtm committed Mar 28, 2016
1 parent d79ecc8 commit 1651f26
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scraper.rb
Expand Up @@ -84,6 +84,10 @@ def scrape_person(id, icon)
# Thanks to @mhl for the regex. TODO: handle group changes
party: groups[tname].to_s.scan(/\w[^\(\),]* *(?:\(.*?\))?/).last || "Unknown",
})
if termid.to_s.empty?
warn "Empty term data in #{url}"
next
end
ScraperWiki.save_sqlite([:id, :term, :party, :start_date], data)

(@TERMS[termid] ||= []) << [start_date, end_date]
Expand All @@ -98,8 +102,8 @@ def scrape_person(id, icon)
term = {
id: t,
name: "Knesset #{t}",
start_date: ds.map(&:first).min,
end_date: ds.map(&:last).max,
start_date: ds.map(&:first).compact.min,
end_date: ds.map(&:last).compact.max,
}
ScraperWiki.save_sqlite([:id], term, 'terms')
end

0 comments on commit 1651f26

Please sign in to comment.