Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaults to parser #11

Merged
merged 1 commit into from
Jan 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def parse_sheets
data_to_insert = [HEADINGS_INSERT, map_data(row, headings)]
begin
x = data_to_insert.transpose.to_h
x.each do |key, value|
if value.is_a? Spreadsheet::Excel::Error
puts "ERROR: #{file} #{x['IFSC']}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the puts, and the nil check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captn3m0 Will drop the nil check. I put the puts there so that the user gets a general idea of the number of errors that might be there in the Excel sheets. Do you still think it should be removed?

x[key] = nil
end
end
data.push x
file_ifsc_mappings[basename] = x['IFSC'][0..3]
rescue Exception => e
Expand Down Expand Up @@ -60,7 +66,7 @@ def map_data(row, headings)
when 'IFSC CODE'
index = HEADINGS_INSERT.find_index 'IFSC'
data[index] = row[heading_index]

else
data[index] = row[heading_index] if index
end
Expand Down Expand Up @@ -185,4 +191,4 @@ def export_to_code_json(list, ifsc_hash)

def log(msg)
puts msg
end
end