Skip to content

Commit

Permalink
Fix enum syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
avinhurry committed Aug 27, 2024
1 parent 45746cf commit b50ba66
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/region_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module RegionCode
# These correspond to the first-level NUTS regions for the UK (minus Northern Ireland)
# https://en.wikipedia.org/wiki/First-level_NUTS_of_the_European_Union#United_Kingdom

enum region_code: {
enum :region_code, {
no_region: 0,
london: 1,
south_east: 2,
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/with_qualifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module WithQualifications
#
# See [UCAS Teacher Training Set-up Guide](https://www.ucas.com/file/115581/download?token=mv-G6P53),
# page 32
enum profpost_flag: {
enum :profpost_flag, {

# Recommendation for QTS: the student will not receive an academic teacher
# training qualification on successful completion of the
Expand Down Expand Up @@ -41,7 +41,7 @@ module WithQualifications
# subjects this course was tagged to.
#
# Defined here: https://github.com/DFE-Digital/manage-courses-api/blob/master/src/ManageCourses.Domain/Models/CourseQualification.cs
enum qualification: { qts: 0, pgce_with_qts: 1, pgde_with_qts: 2, pgce: 3, pgde: 4, undergraduate_degree_with_qts: 5 }
enum :qualification, { qts: 0, pgce_with_qts: 1, pgde_with_qts: 2, pgce: 3, pgde: 4, undergraduate_degree_with_qts: 5 }

# This field may seem like an unnecessary overhead when there is already a
# database-backed `qualification` field. However it's misleading, from the
Expand Down
14 changes: 7 additions & 7 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class Contact < ApplicationRecord
validates :telephone, phone: true, allow_nil: true
validates :permission_given, acceptance: true

enum type: {
admin: 'admin',
utt: 'utt',
web_link: 'web_link',
fraud: 'fraud',
finance: 'finance'
},
enum :type, {
admin: 'admin',
utt: 'utt',
web_link: 'web_link',
fraud: 'fraud',
finance: 'finance'
},
_suffix: 'contact'
end
20 changes: 10 additions & 10 deletions app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ class Course < ApplicationRecord
presence: true,
on: %i[create update]

enum application_status: {
enum :application_status, {
closed: 0,
open: 1
}, _prefix: :application_status

enum course_type: {
enum :course_type, {
postgraduate: 'postgraduate',
undergraduate: 'undergraduate'
}, _suffix: :course_type

enum funding: {
enum :funding, {
not_set: 'not_set',
fee: 'fee',
salary: 'salary',
apprenticeship: 'apprenticeship'
}

enum program_type: {
enum :program_type, {
higher_education_programme: 'HE',
higher_education_salaried_programme: 'HES',
school_direct_training_programme: 'SD',
Expand All @@ -65,19 +65,19 @@ class Course < ApplicationRecord
teacher_degree_apprenticeship: 'TDA'
}

enum study_mode: {
enum :study_mode, {
full_time: 'F',
part_time: 'P',
full_time_or_part_time: 'B'
}

enum level: {
enum :level, {
primary: 'Primary',
secondary: 'Secondary',
further_education: 'Further education'
}, _suffix: :course

enum degree_grade: {
enum :degree_grade, {
two_one: 0,
two_two: 1,
third_class: 2,
Expand All @@ -103,9 +103,9 @@ class Course < ApplicationRecord
# but some require grade 5 ("strong C")
PROVIDERS_REQUIRING_GCSE_GRADE_5 = %w[I30].freeze

enum maths: ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_maths
enum english: ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_english
enum science: ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_science
enum :maths, ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_maths
enum :english, ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_english
enum :science, ENTRY_REQUIREMENT_OPTIONS, _suffix: :for_science

after_validation :remove_unnecessary_enrichments_validation_message
before_save :set_applications_open_from
Expand Down
2 changes: 1 addition & 1 deletion app/models/course_enrichment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class CourseEnrichment < ApplicationRecord
include TouchCourse
include RecruitmentCycleHelper
enum status: { draft: 0, published: 1, rolled_over: 2, withdrawn: 3 }
enum :status, { draft: 0, published: 1, rolled_over: 2, withdrawn: 3 }

jsonb_accessor :json_data,
about_course: [:string, { store_key: 'AboutCourse' }],
Expand Down
4 changes: 2 additions & 2 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Provider < ApplicationRecord
# The `scitt` & `university` provider types can be used to denote
# that they are an `accredited_provider` for accrediting providers
# therefore `lead_school` is a `not_an_accredited_provider`.
enum provider_type: {
enum :provider_type, {
scitt: 'B',
lead_school: 'Y',
university: 'O'
}

enum accrediting_provider: {
enum :accrediting_provider, {
accredited_provider: 'Y',
not_an_accredited_provider: 'N'
}
Expand Down
14 changes: 7 additions & 7 deletions app/models/provider_ucas_preference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
class ProviderUCASPreference < ApplicationRecord
belongs_to :provider

enum type_of_gt12: {
coming_or_not: 'Coming or Not',
coming_enrol: 'Coming / Enrol',
not_coming: 'Not coming',
no_response: 'No response'
},
enum :type_of_gt12, {
coming_or_not: 'Coming or Not',
coming_enrol: 'Coming / Enrol',
not_coming: 'Not coming',
no_response: 'No response'
},
_prefix: 'type_of_gt12'

enum send_application_alerts: {
enum :send_application_alerts, {
all: 'Yes, required',
none: 'No, not required',
my_programmes: 'Yes - only my programmes',
Expand Down
2 changes: 1 addition & 1 deletion app/models/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Site < ApplicationRecord

belongs_to :provider

enum site_type: {
enum :site_type, {
school: 0,
study_site: 1
}
Expand Down
6 changes: 3 additions & 3 deletions app/models/site_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ class SiteStatus < ApplicationRecord
validate :vac_status_must_be_consistent_with_course_study_mode,
if: proc { |s| s.course&.study_mode.present? }

enum vac_status: {
enum :vac_status, {
both_full_time_and_part_time_vacancies: 'B',
part_time_vacancies: 'P',
full_time_vacancies: 'F',
no_vacancies: ''
}

enum status: {
enum :status, {
discontinued: 'D',
running: 'R',
new_status: 'N',
suspended: 'S'
}, _prefix: :status

enum publish: {
enum :publish, {
published: 'Y',
unpublished: 'N'
}, _suffix: :on_ucas
Expand Down

0 comments on commit b50ba66

Please sign in to comment.