Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Handle empty body
Browse files Browse the repository at this point in the history
  • Loading branch information
jarib committed Jun 5, 2017
1 parent a90d57a commit 1f149c0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions script/import-promises-2017
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ sheets.each do |sheet|
promises = data.fetch('Løfter').map.with_index do |promise, idx|
xid = [sheet[:external_id].downcase, period_name, idx + 2].join(':')
raw_body = promise.fetch('LØFTE').to_s.strip
body = "#{sheet[:party]} vil #{UnicodeUtils.downcase raw_body[0]}#{raw_body[1..-1]}"

if body[-1] != "."
body = "#{body}."
if raw_body.blank?
body = ''
else
body = "#{sheet[:party]} vil #{UnicodeUtils.downcase raw_body[0]}#{raw_body[1..-1]}"

if body[-1] != "."
body = "#{body}."
end
end

promise = Hdo::StortingImporter::Promise.new xid,
Expand Down

0 comments on commit 1f149c0

Please sign in to comment.