Skip to content

Commit

Permalink
Skip SQL call when there are no files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Blat committed Jan 18, 2016
1 parent 5bb5190 commit 551a51e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/presupuestos_municipales/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ def import_in_database
def import_year_data(folder, year)
base_path = folder + "/#{@what}/"

executed = false
Dir.foreach(base_path) do |file|
if relevant_file?(file)
executed = true
import_file(base_path + file, year)
end
end

return if !executed

# TODO: clean tb_remanente;
db.execute(<<SQL)
update "tb_cuentasEconomica_#{year}" set cdcta = LTRIM(RTRIM(cdcta));
Expand Down

0 comments on commit 551a51e

Please sign in to comment.