Some of this employee's previous qualifications are no longer approved
+
+ Some of this employees previous qualifications are no longer approved an admin will need to update them as unapproved qualifications do not show for users.
+
+
+ The following are the unnapproved qualifications for this employee, please update them to approved options if they are still valid.
+
+
+ <% @employee.employee_qualifications.each do |qualification| %>
+ <% if !qualification.qualification.approved %>
+
<%= qualification.qualification.name %> <%= qualification.achieved_on.strftime("%d/%m/%Y") if qualification.achieved_on %>
+ <% end %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+
<%= render "employees/editors/qualifications", f: f %>
<% end %>
diff --git a/app/views/admin/employees/show.html.erb b/app/views/admin/employees/show.html.erb
index d099736..02ab559 100644
--- a/app/views/admin/employees/show.html.erb
+++ b/app/views/admin/employees/show.html.erb
@@ -174,6 +174,16 @@
<%= render "admin/shared/collapsible", name: "Qualifications", id: "employee-qualifications" do %>
+
+ <% if @employee.employee_qualifications.any? { |eq| !eq.qualification.approved } %>
+
+
Some of this employee's previous qualifications are no longer approved
+
+ Some of this employees previous qualifications are no longer approved an admin will need to update them as unapproved qualifications do not show for users.
+
+
+ <% end %>
+
<% if @employee.employee_qualifications.present? %>
@@ -182,7 +192,7 @@
<% @employee.employee_qualifications.each do |qualification| %>
-
<%= qualification.qualification.name %>
+
<%= qualification.qualification.name %> <%= "(unapproved)" if !qualification.qualification.approved %>
<%= qualification.achieved_on.strftime("%d/%m/%Y") if qualification.achieved_on %>
<% end %>
diff --git a/app/views/employees/editors/_qualifications.html.erb b/app/views/employees/editors/_qualifications.html.erb
index 6fd9c64..a41301f 100644
--- a/app/views/employees/editors/_qualifications.html.erb
+++ b/app/views/employees/editors/_qualifications.html.erb
@@ -1,10 +1,11 @@
+<% if Qualification.exists? %>
+<% end %>
diff --git a/db/migrate/20240614204249_add_approved_col_to_qualifications.rb b/db/migrate/20240614204249_add_approved_col_to_qualifications.rb
new file mode 100644
index 0000000..8347a1d
--- /dev/null
+++ b/db/migrate/20240614204249_add_approved_col_to_qualifications.rb
@@ -0,0 +1,5 @@
+class AddApprovedColToQualifications < ActiveRecord::Migration[6.1]
+ def change
+ add_column :qualifications, :approved, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6ad06f7..a3373a0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2024_06_14_193034) do
+ActiveRecord::Schema.define(version: 2024_06_14_204249) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -73,6 +73,7 @@
t.integer "order"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.boolean "approved", default: false
end
create_table "services", force: :cascade do |t|
diff --git a/db/seeds.rb b/db/seeds.rb
index 9758cf6..ce7b6bb 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -38,7 +38,7 @@ def employee_attributes
surname: FFaker::Name.last_name,
forenames: FFaker::Name.first_name,
job_title: Employee.new.accepted_job_titles.sample,
- qualifications: Qualification.all.sample(rand(0..Qualification.count)),
+ qualifications: Qualification.all.approved(true).sample(rand(0..Qualification.count)),
roles: accepted_roles.sample(rand(1..accepted_roles.size)) ,
employed_from: FFaker::Time.date(year_latest: 18, year_range: 65 - 18),
diff --git a/spec/controllers/employees_controller_spec.rb b/spec/controllers/employees_controller_spec.rb
index 2b6c12e..3f887e6 100644
--- a/spec/controllers/employees_controller_spec.rb
+++ b/spec/controllers/employees_controller_spec.rb
@@ -93,7 +93,7 @@
surname: FFaker::Name.last_name,
forenames: FFaker::Name.first_name,
job_title: Employee.new.accepted_job_titles.sample,
- qualifications: Qualification.all.sample,
+ qualifications: Qualification.all.approved(true).sample,
roles: Employee.new.accepted_roles.sample,
employed_from: FFaker::Time.date(year_latest: 18, year_range: 65 - 18),
diff --git a/spec/features/managing_employees_spec.rb b/spec/features/managing_employees_spec.rb
index 2648d6c..141486b 100644
--- a/spec/features/managing_employees_spec.rb
+++ b/spec/features/managing_employees_spec.rb
@@ -103,7 +103,7 @@
fill_in :employee_safeguarding_achieved_on, with: safeguarding_achieved_on
check :employee_has_designated_safeguarding_lead
fill_in :employee_designated_safeguarding_lead_achieved_on, with: designated_safeguarding_lead_achieved_on
- Qualification.all.each do |qualification|
+ Qualification.all.approved(true).each do |qualification|
check(qualification.name)
end
click_button 'Continue'
@@ -135,7 +135,7 @@
expect(page).to have_checked_field(:employee_has_safeguarding)
expect(page).to have_field(:employee_designated_safeguarding_lead_achieved_on, with: designated_safeguarding_lead_achieved_on)
expect(page).to have_checked_field(:employee_has_designated_safeguarding_lead)
- Qualification.all.each do |qualification|
+ Qualification.all.approved(true).each do |qualification|
expect(page).to have_checked_field(qualification.name)
end
end
diff --git a/spec/models/employee_spec.rb b/spec/models/employee_spec.rb
index c3ccce5..fd5e232 100644
--- a/spec/models/employee_spec.rb
+++ b/spec/models/employee_spec.rb
@@ -124,19 +124,23 @@
end
end
+
describe '.options_for_qualifications' do
it 'returns an array of options for qualifications' do
expect(Employee.options_for_qualifications).to match_array([
- include('Level 2', a_kind_of(Integer)),
- include('Level 3', a_kind_of(Integer)),
- include('Level 4', a_kind_of(Integer)),
- include('Level 5', a_kind_of(Integer)),
- include('Level 6', a_kind_of(Integer)),
- include('EYPS', a_kind_of(Integer)),
- include('QTS', a_kind_of(Integer)),
- include('EYC', a_kind_of(Integer)),
- ['No qualifications', 'NONE']
+ # include('Unqualified', a_kind_of(Integer)),
+ # include('Level 2', a_kind_of(Integer)),
+ # include('Level 3', a_kind_of(Integer)),
+ # include('Level 4', a_kind_of(Integer)),
+ # include('Level 5', a_kind_of(Integer)),
+ # include('Level 6', a_kind_of(Integer)),
+ # include('Early Years Professional Status', a_kind_of(Integer)),
+ # include('Early Years Teacher Status', a_kind_of(Integer)),
+ # include('Qualified Teacher Status', a_kind_of(Integer)),
+ # include('Level 7', a_kind_of(Integer)),
+ ['Unapproved qualifications', 'UNAPPROVED'],
+ ['No saved qualifications', 'NONE']
])
end
end
-end
+end
\ No newline at end of file