Skip to content

Commit

Permalink
fix typos/specs from code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed May 10, 2024
1 parent e18b91d commit 710e6d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/models/pd_registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ class PdRegistration < ApplicationRecord
validates :attended, inclusion: { in: [true, false] }

def teacher_name
self.teacher.full_name
self.teacher.full_name
end
end
2 changes: 1 addition & 1 deletion app/views/professional_developments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<div class='col-4' id="state_select_container">
<%= f.label :state, class: "label-required", for: "professional_development_state" %>
<%= f.select :state, ProfessionalDevelopment::VALID_STATES, { include_blank: "State" }, { id: "state_select", class: 'form-control' } %>
<%= f.select :state, School::VALID_STATES, { include_blank: "State" }, { id: "state_select", class: 'form-control' } %>
</div>

<div class='col-4' id="state_textfield_container">
Expand Down
7 changes: 2 additions & 5 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@

SeedData.teachers.each do |teacher_attr|
email_address = EmailAddress.find_or_initialize_by(email: teacher_attr.delete(:email))
puts "teacher_attr: #{teacher_attr}"

if email_address.new_record?
puts "email_address.new_record?: #{email_address.new_record?}"

teacher = Teacher.create(teacher_attr)
if teacher.persisted?
email_address.teacher_id = teacher.id
email_address_saved = email_address.save
puts "New teacher created and email_address saved: #{email_address_saved}"
# puts "New teacher created and email_address saved: #{email_address_saved}"
else
puts "Failed to create teacher. Errors: #{teacher.errors.full_messages.join(", ")}"
end
else
teacher = Teacher.find_by(id: email_address.teacher_id)
if teacher&.update(teacher_attr)
puts "Teacher updated successfully."
# puts "Teacher updated successfully."
else
puts "Failed to update teacher. Errors: #{teacher.errors.full_messages.join(", ")}"
end
Expand Down

0 comments on commit 710e6d6

Please sign in to comment.