Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9dec83e
Add scenarios to test school merging feature
kienthuynh Feb 22, 2026
797367b
Add rspec to test school merging controller
kienthuynh Feb 22, 2026
4e84ad6
Add new routes to preview and execute school merging
kienthuynh Feb 22, 2026
a20554f
Add merging schools logic to merge_controller
kienthuynh Feb 22, 2026
1a0485d
Make all schools except current visible to merge modal
kienthuynh Feb 22, 2026
5b4fcb1
Add school merging preview view
kienthuynh Feb 22, 2026
db04667
Correct school merge preview view name
kienthuynh Feb 22, 2026
a6e385d
Update school show view to show modal when merging
kienthuynh Feb 22, 2026
68d0ee7
Add partial to show schools in school merging preview
kienthuynh Feb 22, 2026
05f5bce
making personal website a required field + tests
Feb 22, 2026
4039ab1
Merge branch 'main' into implement-school-merging
kienthuynh Mar 2, 2026
278299a
Update admin.feature:355 to account for factory changes
kienthuynh Mar 2, 2026
d2263e8
Merge branch 'main' into ReqPersonalWebsite
kienthuynh Mar 2, 2026
a310f9e
Merge pull request #68 from cs169/implement-school-merging
kienthuynh Mar 6, 2026
c694d25
Merge pull request #72 from cs169/ReqPersonalWebsite
ronikriger Mar 6, 2026
567e3e7
Revert "Implement school merging"
kienthuynh Mar 6, 2026
d965f00
Merge pull request #82 from cs169/revert-68-implement-school-merging
kienthuynh Mar 6, 2026
87e6079
Update project owner from CS169L-23 to CS169L-26
ronikriger Mar 6, 2026
ef6d6a8
Update member1 details in info.yml
ronikriger Mar 6, 2026
0042463
Merge pull request #84 from cs169/ronikriger-patch-1
ronikriger Mar 6, 2026
ec57390
fixing feedback of PR to golden repo
Mar 9, 2026
b845506
Fix teacher_spec.rb:60 to check validation on creation
kienthuynh Mar 9, 2026
e22c613
Merge pull request #85 from beautyjoy/main
kienthuynh Mar 9, 2026
e6ce838
add school location to teacher view
kienthuynh Mar 9, 2026
591a93e
fix personal_website test
Mar 9, 2026
e6d66fa
please check rubocop
kienthuynh Mar 11, 2026
f0a89e1
Merge branch 'main' into add-school-location-to-teacher-view
kienthuynh Mar 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/teacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class Teacher < ApplicationRecord
accepts_nested_attributes_for :email_addresses, allow_destroy: true

validates :first_name, :last_name, :status, presence: true
validates :personal_website, presence: true, on: :create
validate :valid_languages
before_validation :sort_and_clean_languages

Expand Down
7 changes: 3 additions & 4 deletions app/views/teachers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ status ONLY IF the person viewing this page is an admin. %>

<div class="form-group row">
<div class='col-12'>
<%= f.label :personal_website do %>
Personal or Course Website <i>(optional)</i>
<% end %>
<%= f.label :personal_website, "Personal or Course Website", class: "label-required" %>
<%= f.text_field :personal_website, placeholder: "school.edu", class: "form-control",
pattern: ".+\\..+", title: "Please enter a valid URL." %>
type: "url", required: true %>
</div>
<small class="col-12 form-text text-muted">Please enter a valid URL (e.g. https://example.com).</small>
</div>


Expand Down
1 change: 1 addition & 0 deletions app/views/teachers/_teacher_info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
<div class="row mb-4">
<div class="col-sm-3 font-weight-bold">School Location:</div>
<div class="col-sm-9">
<%= teacher.school_location %>
</div>
</div>
<div class="row">
Expand Down
2 changes: 2 additions & 0 deletions db/seed_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def self.teachers
admin: true,
status: 0,
application_status: "Validated",
personal_website: "https://example.com",
school: School.find_by(name: "UC Berkeley"),

# Note: email field does not exist in the schema of the Teacher model
Expand All @@ -186,6 +187,7 @@ def self.teachers
admin: true,
status: 0,
application_status: "Validated",
personal_website: "https://example.com",
school: School.find_by(name: "UC Berkeley"),

email: "lmock@berkeley.edu",
Expand Down
17 changes: 9 additions & 8 deletions features/admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ Feature: basic admin functionality
And I should see "Edit Information"
And I should see "School"
And I should see "School Location"
And I should see "Berkeley, CA"
And I should see "Email"
And I should see "Personal or Course Website"

Expand Down Expand Up @@ -357,9 +358,9 @@ Feature: basic admin functionality
| name | country | city | state | website | grade_level | school_type |
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
And the following teachers exist:
| first_name | last_name | personal_website | admin | primary_email | school | application_status |
| Jane | Doe | abc@berkeley.edu | false | janedoe@berkeley.edu | UC Berkeley | validated |
| Bobby | John | | false | bobbyjohn@berkeley.edu | UC Berkeley | denied |
| first_name | last_name | personal_website | admin | primary_email | school | application_status | snap |
| Jane | Doe | https://abc.berkeley.edu | false | janedoe@berkeley.edu | UC Berkeley | validated | jdoe |
| Bobby | John | https://bob.berkeley.com | false | bobbyjohn@berkeley.edu | UC Berkeley | denied | |
Given I am on the BJC home page
And I have an admin email
And I follow "Log In"
Expand All @@ -368,12 +369,12 @@ Feature: basic admin functionality
And I follow "Confirm Merge"
Then I see a confirmation "Teachers merged successfully"
And the following entries should not exist in the teachers database:
| first_name | last_name | personal_website | admin | primary_email | school | application_status |
| Jane | Doe | https://abc.berkeley.edu | false | janedoe@berkeley.edu | UC Berkeley | validated |
| Bobby | John | | false | bobbyjohn@berkeley.edu | UC Berkeley | denied |
| first_name | last_name | personal_website | admin | primary_email | school | application_status | snap |
| Jane | Doe | https://abc.berkeley.edu | false | janedoe@berkeley.edu | UC Berkeley | validated | jdoe |
| Bobby | John | https://bob.berkeley.com | false | bobbyjohn@berkeley.edu | UC Berkeley | denied | |
And the following entries should exist in the teachers database:
| first_name | last_name | personal_website | admin | primary_email | school | application_status |
| Bobby | John | abc@berkeley.edu | false | bobbyjohn@berkeley.edu | UC Berkeley | denied |
| first_name | last_name | personal_website | admin | primary_email | school | application_status | snap |
| Bobby | John | https://bob.berkeley.com | false | bobbyjohn@berkeley.edu | UC Berkeley | denied | jdoe |

Scenario: Merging teachers sums session counts, concatenates IP histories, and saves most recent datetime
Given the following schools exist:
Expand Down
25 changes: 25 additions & 0 deletions features/form_submission.feature
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ Feature: submit a form as a teacher
Then The "#new_teacher" form is invalid
And I am on the BJC home page

Scenario: Missing the compulsory personal website field
Given "kpzhu@berkeley.edu" is not in the database
Given I am on the BJC home page
And I enter my "First Name" as "Kimberly"
And I enter my "Last Name" as "Zhu"
And I enter my "School Email" as "TESTkpzhu@berkeley.edu"
And I enter my "Snap! Username" as "kpzhu"
And I set my status as "I am teaching BJC as an AP CS Principles course."
And I set my education level target as "High School"
And I fill in "More Information" with "I am after school volunteer"
And I fill in the school name selectize box with "Cupertino High School" and choose to add a new school
And I select "United States" from "Country"
And I enter my "City" as "Cupertino"
And I select "CA" from "State" dropdown
And I enter my "School Website" as "https://chs.fuhsd.org"
And I select "University" from "Grade Level"
And I select "Public" from "School Type"
And I press "Submit"
Then The "#new_teacher" form is invalid
And I am on the BJC home page

Scenario: Websites validation - two invalid websites
Given I am on the BJC home page
And I enter my "First Name" as "Jonathan"
Expand All @@ -91,6 +112,7 @@ Feature: submit a form as a teacher
And I enter my "First Name" as "Jonathan"
And I enter my "Last Name" as "Cena"
And I enter my "School Email" as "jonathancena@wwe.com"
And I enter my "Personal or Course Website" as "https://jonathancena.com"
And I set my status as "I am teaching BJC as an AP CS Principles course."
And I set my education level target as "High School"
And I fill in "More Information" with "I am teaching BJC"
Expand All @@ -110,6 +132,7 @@ Feature: submit a form as a teacher
And I enter my "First Name" as "Jonathan"
And I enter my "Last Name" as "Cena"
And I enter my "School Email" as "jonathancena@wwe.com"
And I enter my "Personal or Course Website" as "https://jonathancena.com"
And I set my status as "I am teaching BJC as an AP CS Principles course."
And I set my education level target as "High School"
And I fill in "More Information" with "I am teaching BJC"
Expand All @@ -131,6 +154,7 @@ Feature: submit a form as a teacher
And I enter my "First Name" as "Mallory"
And I enter my "Last Name" as "Moore"
And I enter my "School Email" as "alice@berkeley.edu"
And I enter my "Personal or Course Website" as "https://example.com"
And I set my status as "I am teaching BJC as an AP CS Principles course."
And I set my education level target as "High School"
And I fill in "More Information" with "I am teaching BJC"
Expand All @@ -154,6 +178,7 @@ Feature: submit a form as a teacher
And I enter my "First Name" as "Mallory"
And I enter my "Last Name" as "Moore"
And I enter my "School Email" as "mallory@berkeley.edu"
And I enter my "Personal or Course Website" as "https://example.com"
And I enter my "Snap! Username" as "aliceadams"
And I set my status as "I am teaching BJC as an AP CS Principles course."
And I fill in "More Information" with "I am teaching BJC"
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/teacher_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
education_level: 1,
more_info: "default more_info",
admin: false,
personal_website: "",
personal_website: "https://example.com",
application_status: "Not Reviewed",
languages: ["English"],
session_count: 1,
Expand Down
11 changes: 5 additions & 6 deletions info.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
project:
name: 'BJC-Teacher-Tracker'
owner: 'CS169L-23'
owner: 'CS169L-26'
teamId: '03'
identities:
pivotal: 'https://www.pivotaltracker.com/n/projects/2406982'
heroku: 'https://sp23-03-bjc-teachers.herokuapp.com'
members:
member1:
name: 'Governify'
surname: 'Auditor'
githubUsername: 'governifyauditor'
pivotalUsername: 'governifyauditor'
herokuEmail: 'governify.auditor@gmail.com'
name: 'Roni'
surname: 'Kriger'
githubUsername: 'ronikriger'
herokuEmail: 'krigerroni@gmail.com'
member2:
name: 'Chuang'
surname: 'Yao'
Expand Down
8 changes: 5 additions & 3 deletions spec/controllers/teachers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ApplicationController.any_instance.stub(:is_admin?).and_return(false)
short_app = Teacher.find_by(first_name: "Short")
post :create, params: { teacher: { first_name: "First", last_name: "Last", status: 0, education_level: 0,
password: "pa33word!", more_info: "info",
password: "pa33word!", more_info: "info", personal_website: "https://example.com",
school_id: short_app.school_id },
email: { primary: "new@user.com" }
}
Expand All @@ -27,7 +27,7 @@
ApplicationController.any_instance.stub(:is_admin?).and_return(false)
short_app = Teacher.find_by(first_name: "Short")
post :create, params: { teacher: { first_name: "First", last_name: "Last", status: 0, education_level: 0,
password: "pa33word!", more_info: "info",
password: "pa33word!", more_info: "info", personal_website: "https://example.com",
school_id: short_app.school_id },
email: { primary: "new@user.com" }
}
Expand All @@ -41,7 +41,7 @@
short_app = Teacher.find_by(first_name: "Short")
session_count_orig = short_app.session_count
post :create, params: { teacher: { first_name: "Short", last_name: "Last", status: 0, education_level: 0,
password: "pa33word!", more_info: "info",
password: "pa33word!", more_info: "info", personal_website: "https://example.com",
school_id: short_app.school_id },
email: { primary: short_app.primary_email }
}
Expand Down Expand Up @@ -170,6 +170,7 @@
status: 0,
snap: "valid_example",
admin: true,
personal_website: "https://example.com",
school_id: School.first.id
},
email: {
Expand All @@ -191,6 +192,7 @@
status: 0,
application_status: "validated",
snap: "valid_example",
personal_website: "https://example.com",
school_id: School.first.id,
},
email: {
Expand Down
3 changes: 2 additions & 1 deletion spec/controllers/teachers_signup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
first_name: "valid_example",
last_name: "valid_example",
status: 0,
snap: "valid_example"
snap: "valid_example",
personal_website: "https://example.com"
},
email: {
primary: "valid_example@validexample.edu",
Expand Down
6 changes: 6 additions & 0 deletions spec/fixtures/teachers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ admin:
last_name: Wang
status: 4
more_info: A CS169 Student
personal_website: https://example.com
snap: ye
application_status: Validated
education_level: -1
Expand All @@ -55,6 +56,7 @@ validated_teacher:
last_name: Teacher
status: 4
more_info: A CS169 Student
personal_website: https://example.com
snap: validated
application_status: Validated
education_level: -1
Expand All @@ -67,6 +69,7 @@ bob:
snap: BobJohnson
status: 1
more_info: ''
personal_website: https://example.com
application_status: Denied
school: berkeley
education_level: -1
Expand All @@ -79,6 +82,7 @@ long:
status: 3
school: berkeley
more_info: ''
personal_website: https://example.com
application_status: Not Reviewed
education_level: 2

Expand All @@ -89,6 +93,7 @@ reimu:
snap: reimu
status: 4
more_info: Best Touhou Character
personal_website: https://example.com
school: berkeley
application_status: Info Needed
education_level: -1
Expand All @@ -100,6 +105,7 @@ barney:
snap: barney
status: 1
more_info: ''
personal_website: https://example.com
application_status: Denied
school: berkeley
education_level: -1
11 changes: 11 additions & 0 deletions spec/models/teacher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@
expect(teacher.valid?).to be true
end

it "requires personal_website" do
new_teacher = Teacher.new(
first_name: "Test",
last_name: "User",
status: "non_csp_teacher",
personal_website: ""
)
expect(new_teacher).not_to be_valid
expect(new_teacher.errors[:personal_website]).to include("can't be blank")
end

it "shows a text status" do
expect(teacher.text_status).to eq "I am teaching BJC but not as an AP CS Principles course."
end
Expand Down
Loading