Skip to content

Commit

Permalink
TestApplications remove phase and apply_again logic
Browse files Browse the repository at this point in the history
  • Loading branch information
elceebee committed Jun 26, 2024
1 parent d744591 commit ed66d42
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions app/lib/test_applications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def create_application(
recruitment_cycle_year:,
states:,
courses_to_apply_to:,
apply_again: false,
carry_over: false,
course_full: false,
candidate: nil,
Expand All @@ -43,7 +42,6 @@ def create_application(
recruitment_cycle_year:,
states:,
courses:,
apply_again:,
carry_over:,
candidate:,
incomplete_references:,
Expand Down Expand Up @@ -84,31 +82,14 @@ def create_application_to_courses(
recruitment_cycle_year:,
states:,
courses:,
apply_again: false,
carry_over: false,
candidate: nil,
application_in_past: false,
incomplete_references: false
)
raise CourseAndStateNumbersDoNotMatchError unless courses.count == states.count

if apply_again
raise OnlyOneCourseWhenApplyingAgainError unless states.one?

create_application_to_courses(
application_in_past: true,
recruitment_cycle_year:,
courses:,
states: [:rejected],
candidate:,
)

initialize_time(recruitment_cycle_year, application_in_past:)
candidate = candidate.presence || Candidate.last
first_name = candidate.current_application.first_name
last_name = candidate.current_application.last_name
previous_application_form = candidate.current_application
elsif carry_over
if carry_over
courses_from_last_year = Course.with_course_options.distinct.in_cycle(recruitment_cycle_year - 1).sample(rand(1..3))
create_application_to_courses(
recruitment_cycle_year: recruitment_cycle_year - 1,
Expand Down Expand Up @@ -161,7 +142,6 @@ def create_application_to_courses(
created_at: time,
updated_at: time,
recruitment_cycle_year:,
phase: apply_again ? 'apply_2' : 'apply_1',
previous_application_form:,
references_count: 0,
)
Expand Down Expand Up @@ -563,7 +543,7 @@ def initialize_time(recruitment_cycle_year, application_in_past: false)
end
else
earliest_date = CycleTimetable.apply_opens(recruitment_cycle_year)
latest_date = CycleTimetable.apply_1_deadline(recruitment_cycle_year)
latest_date = CycleTimetable.apply_deadline(recruitment_cycle_year)
end

@time = rand(earliest_date..latest_date)
Expand Down

0 comments on commit ed66d42

Please sign in to comment.