Last active
August 31, 2017 16:45
-
-
Save ornerymoose/6122ddafa8f0460dcad0338145e850e8 to your computer and use it in GitHub Desktop.
line 11: File.size comes back as not equal to 0 (which is good) in Rails Console, but returns 0 when run in the below method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_close | |
daily_closed_tickets = Fst.sum_retrieve_closed_tickets | |
daily_closed_tickets.each do |ticket| | |
CSV.open("/var/www/html/harmonize/public/close/CLOSED_#{ticket.attributes['TroubleTicketNumber']}_sum.txt", "w+", {force_quotes: false}) do |csv| | |
if (ticket.attributes['ClosedDate'].present? && ticket.attributes['CauseCode'].present? && (FileCopyReceipt.exists?(path: "/var/www/html/harmonize/public/open/OPEN_#{ticket.attributes['TroubleTicketNumber']}_sum.txt"))) | |
csv << ["GENERATE CSV WITH ATTRIBUTES HERE"] | |
files = Dir.glob("/var/www/html/harmonize/public/close/CLOSED_#{ticket.attributes['TroubleTicketNumber']}_sum.txt") | |
files.each do |f| | |
Rails.logger.info "CHECKING SUM PATH (should be false): #{FileCopyReceipt.exists?(path: f)}" | |
Rails.logger.info "File size (should return non-0): #{File.size(f)}" #returns 0, but not in Rails Console | |
Rails.logger.info "File size true or false, should be true: #{File.size(f) != 0}" #returns false, should return true | |
Rails.logger.info "Rails Environment: #{Rails.env}" #returns production | |
if(!FileCopyReceipt.exists?(path: f) && (File.size(f) != 0)) | |
Rails.logger.info("SUM CLOSE, GOOD => FileUtils.cp_r occurred and FileCopyReceipt object created") | |
else | |
Rails.logger.info("SUM CLOSE, WARNING: => no data transfer occurred") | |
end | |
end | |
else | |
Rails.logger.info("SUM CLOSE => DID NOT make it into initial if ClosedDate.present? if block") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment