Skip to content

Commit

Permalink
Add course length default value
Browse files Browse the repository at this point in the history
There was two options: Use FourYears like a enumerator or free text.
After giving too much thought I opt-in for free text as this will
unlikely to change in content
  • Loading branch information
tomas-stefano authored and avinhurry committed May 21, 2024
1 parent a44fc42 commit 343fb27
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/services/courses/creation_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def build_new_course
course.can_sponsor_student_visa = false
course.can_sponsor_skilled_worker_visa = false
course.degree_grade = 'not_required'
course_enrichment = course.enrichments.find_or_initialize_draft
course_enrichment.course_length = '4 years'
end

AssignSubjectsService.call(course:, subject_ids:)
Expand Down
2 changes: 2 additions & 0 deletions spec/features/publish/courses/new_tda_course_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ def and_the_tda_defaults_are_saved
expect(course.additional_degree_subject_requirements).to be_nil
expect(course.degree_subject_requirements).to be_nil
expect(course.degree_grade).to eq('not_required')
expect(course.enrichments.last).to be_present
expect(course.enrichments.last.course_length).to eq('4 years')
end

def and_i_select_no_send
Expand Down
2 changes: 2 additions & 0 deletions spec/services/courses/creation_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
expect(subject.additional_degree_subject_requirements).to be_nil
expect(subject.degree_subject_requirements).to be_nil
expect(subject.degree_grade).to eq('not_required')
expect(subject.enrichments.last).to be_present
expect(subject.enrichments.last.course_length).to eq('4 years')
end
end

Expand Down

0 comments on commit 343fb27

Please sign in to comment.