Class: Services::MdsUpload

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
MdsNotifications, MdsUploadContent
Defined in:
app/models/services/mds_upload.rb

Constant Summary collapse

NEW =
0
ASSESSMENTS_LOADED =
1
COMPLETE =
2
ERROR =
3
TIME_TO_RUN =
36000
PRIORITY =
500
ASYNC_SEND_OPTIONS =
{ :priority => PRIORITY, :time_to_run => TIME_TO_RUN }

Instance Method Summary collapse

Methods included from MdsNotifications

#handle_mds_notifications, #notify_the_uploader?, #send_upload_confirmation

Methods included from MdsUploadContent

included

Instance Method Details

#add_file_errors(file_name, error) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'app/models/services/mds_upload.rb', line 40

def add_file_errors(file_name, error)
  self.file_errors ||= {}
  error_array = error.is_a?(Array) ? error : [ error ]
  if self.file_errors[file_name].present?
    self.file_errors[file_name].concat(error_array)
  else
    self.file_errors[file_name] = error_array
  end
end

#has_errors?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/models/services/mds_upload.rb', line 50

def has_errors?
  status == COMPLETE && (fatal_error.present? || file_errors.size > num_duplicated)
end

#ready_for_notification?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'app/models/services/mds_upload.rb', line 58

def ready_for_notification?
  status == COMPLETE
end

#successful?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'app/models/services/mds_upload.rb', line 54

def successful?
  status == COMPLETE
end