Skip to content

Commit

Permalink
394: Add low-fi view ECT record
Browse files Browse the repository at this point in the history
  • Loading branch information
edujackedu committed Oct 7, 2024
1 parent b559786 commit f7fef0e
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 18 deletions.
5 changes: 5 additions & 0 deletions app/helpers/appropriate_body_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ def induction_programme_choices
]
end

def induction_programme_choice_name(identifier)
# FIXME: this is a temporary solution until we have real induction programme data
induction_programme_choices.find { |choice| choice.identifier == identifier }&.name
end

def induction_outcome_choices
[
InductionProgrammeChoice.new(identifier: 'pass', name: 'Passed'),
Expand Down
3 changes: 2 additions & 1 deletion app/services/appropriate_bodies/claim_an_ect/register_ect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def register(pending_induction_submission_params)
def update_teacher_name
teacher.update(
first_name: pending_induction_submission.trs_first_name,
last_name: pending_induction_submission.trs_last_name
last_name: pending_induction_submission.trs_last_name,
date_of_birth: pending_induction_submission.date_of_birth
)
end

Expand Down
52 changes: 44 additions & 8 deletions app/views/appropriate_bodies/teachers/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,31 +1,67 @@
<% page_data(title: Teachers::Name.new(@teacher).full_name, error: false) %>

<div class="govuk-button-group">
<%= govuk_button_link_to("Release ECT", new_ab_teacher_release_ect_path(@teacher), secondary: true) %>
<%= govuk_button_link_to("Record induction outcome", new_ab_teacher_record_outcome_path(@teacher), secondary: true) %>
<%= govuk_button_link_to("Record induction outcome", new_ab_teacher_record_outcome_path(@teacher)) %>
</div>

<h2 class="govuk-heading-m">Early career teacher<h2>

<%=
govuk_summary_list do |sl|
sl.with_row do |row|
row.with_key(text: "Teacher record number")
row.with_key(text: "Name")
row.with_value(text: Teachers::Name.new(@teacher).full_name)
end

sl.with_row do |row|
row.with_key(text: "TRN")
row.with_value(text: @teacher.trn)
end

sl.with_row do |row|
row.with_key(text: "First name")
row.with_value(text: @teacher.first_name)
row.with_key(text: "Date of birth")
row.with_value(text: @teacher.date_of_birth&.to_fs(:govuk))
end

sl.with_row do |row|
row.with_key(text: "Last name")
row.with_value(text: @teacher.last_name)
row.with_key(text: "Induction status")

# FIXME: This is a placeholder. The actual status should be displayed here.
row.with_value(text: govuk_tag(text: "placeholder", colour: %w[grey green red purple orange yellow].sample))
end
end
%>

<h2 class="govuk-heading-m">Induction history<h2>

<mark class="govuk-body">Add this later.</mark>
<%= govuk_summary_list do |sl|
sl.with_row do |row|
row.with_key(text: "Induction start date")
row.with_value(text: Teachers::InductionPeriod.new(@teacher).induction_start_date&.to_fs(:govuk))
end
end

govuk_table do |table|
table.with_caption(size: 'm', text: '')

table.with_head do |head|
head.with_row do |row|
row.with_cell(text: 'Appropriate body')
row.with_cell(text: 'Induction programme')
row.with_cell(text: 'Start date')
row.with_cell(text: 'End date')
row.with_cell(text: 'Number of terms', numeric: true)
end
end
table.with_body do |body|
@teacher.induction_periods_reported_by_appropriate_body.each do |induction_period |
body.with_row do |row|
row.with_cell(text: induction_period.appropriate_body.name)
row.with_cell(text: induction_programme_choice_name(induction_period.induction_programme))
row.with_cell(text: induction_period.started_on.to_fs(:govuk))
row.with_cell(text: induction_period.finished_on&.to_fs(:govuk))
row.with_cell(text: induction_period.number_of_terms, numeric: true)
end
end
end
end %>
5 changes: 5 additions & 0 deletions db/migrate/20241007103740_add_date_of_birth_to_teacher.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddDateOfBirthToTeacher < ActiveRecord::Migration[7.2]
def change
add_column :teachers, :date_of_birth, :date
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2024_10_03_132805) do
ActiveRecord::Schema[7.2].define(version: 2024_10_07_103740) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "plpgsql"
Expand Down Expand Up @@ -379,6 +379,7 @@
t.string "last_name", null: false
t.virtual "search", type: :tsvector, as: "to_tsvector('english'::regconfig, (((((COALESCE(first_name, ''::character varying))::text || ' '::text) || (COALESCE(last_name, ''::character varying))::text) || ' '::text) || (COALESCE(corrected_name, ''::character varying))::text))", stored: true
t.datetime "induction_start_date_submitted_to_trs_at"
t.date "date_of_birth"
t.index ["corrected_name"], name: "index_teachers_on_corrected_name"
t.index ["first_name", "last_name", "corrected_name"], name: "index_teachers_on_first_name_and_last_name_and_corrected_name", opclass: :gin_trgm_ops, using: :gin
t.index ["search"], name: "index_teachers_on_search", using: :gin
Expand Down
70 changes: 62 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,54 @@ def describe_mentorship_period(mp)

print_seed_info("Adding teachers")

emma_thompson = Teacher.create!(first_name: 'Emma', last_name: 'Thompson', trn: '1023456')
kate_winslet = Teacher.create!(first_name: 'Kate', last_name: 'Winslet', trn: '1023457')
alan_rickman = Teacher.create!(first_name: 'Alan', last_name: 'Rickman', trn: '2084589')
hugh_grant = Teacher.create!(first_name: 'Hugh', last_name: 'Grant', trn: '3657894')
Teacher.create!(first_name: 'Harriet', last_name: 'Walter', trn: '2017654')
hugh_laurie = Teacher.create!(first_name: 'Hugh', last_name: 'Laurie', trn: '4786654')
Teacher.create!(first_name: 'Imogen', last_name: 'Stubbs', trn: '6352869')
Teacher.create!(first_name: 'Gemma', last_name: 'Jones', trn: '9578426')
emma_thompson = Teacher.create!(
first_name: 'Emma',
last_name: 'Thompson',
trn: '1023456',
date_of_birth: Date.new(1950, 4, 15)
)
kate_winslet = Teacher.create!(
first_name: 'Kate',
last_name: 'Winslet',
trn: '1023457',
date_of_birth: Date.new(1960, 5, 16)
)
alan_rickman = Teacher.create!(
first_name: 'Alan',
last_name: 'Rickman',
trn: '2084589',
date_of_birth: Date.new(1970, 6, 17)
)
hugh_grant = Teacher.create!(
first_name: 'Hugh',
last_name: 'Grant',
trn: '3657894',
date_of_birth: Date.new(1980, 7, 18)
)
harriet_walter = Teacher.create!(
first_name: 'Harriet',
last_name: 'Walter',
trn: '2017654',
date_of_birth: Date.new(1990, 8, 19)
)
hugh_laurie = Teacher.create!(
first_name: 'Hugh',
last_name: 'Laurie',
trn: '4786654',
date_of_birth: Date.new(2000, 9, 20)
)
Teacher.create!(
first_name: 'Imogen',
last_name: 'Stubbs',
trn: '6352869',
date_of_birth: Date.new(1930, 10, 21)
)
Teacher.create!(
first_name: 'Gemma',
last_name: 'Jones',
trn: '9578426',
date_of_birth: Date.new(1940, 4, 22)
)

print_seed_info("Adding schools")

Expand Down Expand Up @@ -253,6 +293,20 @@ def describe_mentorship_period(mp)
finished_on: nil
).tap { |mp| describe_mentorship_period(mp) }

print_seed_info("Harriet Walter (mentor)", indent: 2)

PeriodBuilders::InductionPeriodBuilder.new(
appropriate_body: umber_teaching_school_hub,
teacher: harriet_walter,
school: abbey_grove_school
).build(started_on: 2.years.ago, finished_on: 1.year.ago)

PeriodBuilders::InductionPeriodBuilder.new(
appropriate_body: golden_leaf_academy,
teacher: harriet_walter,
school: abbey_grove_school
).build(started_on: 1.year.ago)

print_seed_info("Adding persona users")

User.create!(name: "Velma Dinkley (AB)", email: "[email protected]").tap do |velma_dinkley|
Expand Down

0 comments on commit f7fef0e

Please sign in to comment.