Browse Source

Code review changes

pull/486/head
Stéphane Meny 3 years ago
parent
commit
eef57de038
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 1
      .github/workflows/production_pipeline.yml
  2. 1
      .github/workflows/staging_pipeline.yml
  3. 12
      app/services/imports/case_logs_import_service.rb
  4. 2
      app/services/imports/import_service.rb

1
.github/workflows/production_pipeline.yml

@ -180,5 +180,4 @@ jobs:
cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE
cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE
cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN
cf set-env $APP_NAME RAILS_LOG_TO_STDOUT true
cf push $APP_NAME --strategy rolling

1
.github/workflows/staging_pipeline.yml

@ -148,5 +148,4 @@ jobs:
cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE
cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE
cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN
cf set-env $APP_NAME RAILS_LOG_TO_STDOUT true
cf push $APP_NAME --strategy rolling

12
app/services/imports/case_logs_import_service.rb

@ -152,6 +152,16 @@ module Imports
attributes["is_la_inferred"] = false # Always keep the given LA
attributes["first_time_property_let_as_social_housing"] = first_time_let(attributes["rsnvac"])
unless attributes["brent"].nil? &&
attributes["scharge"].nil? &&
attributes["pscharge"].nil? &&
attributes["supcharg"].nil?
attributes["brent"] ||= BigDecimal("0.0")
attributes["scharge"] ||= BigDecimal("0.0")
attributes["pscharge"] ||= BigDecimal("0.0")
attributes["supcharg"] ||= BigDecimal("0.0")
end
case_log = CaseLog.new(attributes)
case_log.save!
compute_differences(case_log, attributes)
@ -178,7 +188,7 @@ module Imports
def safe_string_as_decimal(xml_doc, attribute)
str = field_value(xml_doc, "xmlns", attribute)
if str.blank?
BigDecimal("0.0")
nil
else
BigDecimal(str, exception: false)
end

2
app/services/imports/import_service.rb

@ -14,7 +14,7 @@ module Imports
xml_document = Nokogiri::XML(file_io)
send(create_method, xml_document)
rescue StandardError => e
@logger.error "#{e.class} #{e.message}"
@logger.error "#{e.class} in #{filename}: #{e.message}"
end
end

Loading…
Cancel
Save