app/workers/education_form/process10203_submissions.rb
# Makes a list of all submissions that have not been processed and have a status of INIT
# Finds most recent submission that has already been processed
#
# Submissions are marked as processed in EducationForm::CreateDailySpoolFiles
#
# For each unprocessed submission compare isEnrolledStem, isPursuingTeachingCert, and benefitLeft values
#     to most recent processed submissions
# If values are the same set status as PROCESSED
# Otherwise check submission data and EVSS data to see if submission can be marked as PROCESSED
Makes a list of all submissions that have not been processed and have a status of INIT
Finds most recent submission that has already been processed

Submissions are marked as processed in EducationForm::CreateDailySpoolFiles

For each unprocessed submission compare isEnrolledStem, isPursuingTeachingCert, and benefitLeft values
to most recent processed submissions
If values are the same set status as PROCESSED
Otherwise check submission data and EVSS data to see if submission can be marked as PROCESSED
Makes a list of all submissions that have not been processed and have a status of INIT Finds most recent submission that has already been processed Submissions are marked as processed in EducationForm :: CreateDailySpoolFiles For each unprocessed submission compare isEnrolledStem isPursuingTeachingCert and benefitLeft values to most recent processed submissions If values are the same set status as PROCESSED Otherwise check submission data and EVSS data to see if submission can be marked as PROCESSED
def check_previous_submissions(submissions, user_has_poa)
      unprocessed_submissions = submissions.find_all do |ebc|
        ebc.processed_at.nil? &&
          ebc.education_stem_automated_decision&.automated_decision_state == EducationStemAutomatedDecision::INIT
      end
      most_recent_processed = submissions.find_all do |ebc|
        ebc.processed_at.present? &&
          ebc.education_stem_automated_decision&.automated_decision_state != EducationStemAutomatedDecision::INIT
      end
                                         .max_by(&:processed_at)
      processed_form = format_application(most_recent_processed) if most_recent_processed.present?
      unprocessed_submissions.each do |submission|
        unprocessed_form = format_application(submission)
        if repeat_form?(unprocessed_form, processed_form)
          update_automated_decision(submission, EducationStemAutomatedDecision::PROCESSED, user_has_poa)
        else
          process_submission(submission, user_has_poa)
        end
      end
    end
def check_previous_submissions ( submissions , user_has_poa ) unprocessed_submissions = submissions . find_all do | ebc | ebc . processed_at . nil? && ebc . education_stem_automated_decision &. automated_decision_state == EducationStemAutomatedDecision :: INIT end most_recent_processed = submissions . find_all do | ebc | ebc . processed_at . present? && ebc . education_stem_automated_decision &. automated_decision_state != EducationStemAutomatedDecision :: INIT end . max_by ( & :processed_at ) processed_form = format_application ( most_recent_processed ) if most_recent_processed . present? unprocessed_submissions . each do | submission | unprocessed_form = format_application ( submission ) if repeat_form? ( unprocessed_form , processed_form ) update_automated_decision ( submission , EducationStemAutomatedDecision :: PROCESSED , user_has_poa ) else process_submission ( submission , user_has_poa ) end end end
Makes a list of all submissions that have not been processed and have a status of INIT
Finds most recent submission that has already been processed
Makes a list of all submissions that have not been processed and have a status of INIT Finds most recent submission that has already been processed
submissions
user_has_poa