Skip to content

Commit

Permalink
merge @beautyjoy / main
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed May 10, 2024
2 parents 19dc0d8 + 2f7823d commit 4272ddc
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 74 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish Code Climate
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
$CCTR sum-coverage coverage/codeclimate.*.json
$CCTR upload-coverage --id "$CC_TEST_REPORTER_ID"
# - name: Publish Code Climate
# run: |
# export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
# $CCTR sum-coverage coverage/codeclimate.*.json
# $CCTR upload-coverage --id "${{ secrets.CC_TEST_REPORTER_ID }}"
7 changes: 3 additions & 4 deletions app/models/school.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def website
end

def location
"#{city}, #{state}, #{country}"
country_text = country == "US" ? "" : ", #{country}"
"#{city}, #{state}#{country_text}"
end

# TODO: Consider renaming this.
Expand Down Expand Up @@ -107,9 +108,7 @@ def format_school(data)
end

def self.search_list
School.pluck(:name, :city, :state, :country).map do |data|
format_school(data)
end
School.pluck(:name, :city, :state, :country).map(&:format_school)
end

def self.grade_level_options
Expand Down
2 changes: 1 addition & 1 deletion app/views/schools/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class='form-group row'>
<div class='col-4'>
<%= f.label :city, class: "label-required", for: "school_city" %>
<%= f.text_field :city, placeholder: 'Name of City', class: 'form-control',
<%= f.text_field :city, placeholder: 'Berkeley', class: 'form-control',
required: false, id: 'school_city' %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/schools/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="row mt-3 pb-3">
<div class="col-sm-4">
<h5>Location</h5>
<%= "#{@school.location}, #{@school.country}" %>
<%= @school.location %>
</div>

<div class="col-sm-4">
Expand Down
1 change: 0 additions & 1 deletion app/views/teachers/_table_headers.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
<th scope="col">Status</th>
<th scope="col" width="15ch">Snap<i>!</i></th>
<th scope="col">School</th>
<th scope="col">Country</th>
<th scope="col" data-col="status" width="7ch">Approved?</th>
<th scope="col" width="12ch">Created</th>
3 changes: 0 additions & 3 deletions app/views/teachers/_teacher.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
<%= link_to(teacher.school.name, school_path(teacher.school)) %>
<%= teacher.school.location %>
</td>
<td>
<%= teacher.school.country %>
</td>
<td data-search="<%= teacher.application_status %>" data-col="status" >
<%= teacher.short_application_status %>
</td>
Expand Down
1 change: 0 additions & 1 deletion app/views/teachers/_teacher_info.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
<div class="row mb-4">
<div class="col-sm-4 font-weight-bold">School Location:</div>
<div class="col-sm-8">
<%= "#{teacher.school.location}" %>
</div>
</div>
<div class="row">
Expand Down
54 changes: 5 additions & 49 deletions features/admin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,6 @@ Feature: basic admin functionality
And I press "Update"
Then I should not have sent out any emails

Scenario: Updating application status persists changes in database
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
Given the following teachers exist:
| first_name | last_name | admin | primary_email | school | snap | application_status |
| Bobby | John | false | testteacher@berkeley.edu | UC Berkeley | bobby | denied |
Given I am on the BJC home page
And I have an admin email
And I follow "Log In"
Then I can log in with Google
When I go to the teachers page
And I go to the edit page for Bobby John
And I set my application status as "Validated"
And I press "Update"
Then I see a confirmation "Saved"
When I go to the teachers page
And I check "Validated"
Then I should see "Bobby John"

Scenario: Deny teacher as an admin
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
Expand Down Expand Up @@ -234,30 +214,6 @@ Feature: basic admin functionality
When I go to the edit page for Joseph Mamoa
Then should see "You need to log in to access this."

Scenario: Filter all teacher info as an admin
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
Given the following teachers exist:
| first_name | last_name | admin | primary_email | school | application_status |
| Victor | Validateme | false | testteacher1@berkeley.edu | UC Berkeley | Validated |
| Danny | Denyme | false | testteacher2@berkeley.edu | UC Berkeley | Denied |
| Peter | Pendme | false | testteacher3@berkeley.edu | UC Berkeley | Not Reviewed |
Given I am on the BJC home page
Given I have an admin email
And I follow "Log In"
Then I can log in with Google
When I go to the teachers page
And I check "Not Reviewed"
And I uncheck "Validated"
Then I should see "Peter"
Then I should not see "Victor"
Then I should not see "Danny"
And I check "Validated"
Then I should see "Peter"
Then I should see "Victor"
Then I should not see "Danny"

Scenario: View teacher info as an admin
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
Expand Down Expand Up @@ -385,7 +341,7 @@ Feature: basic admin functionality
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
And the following teachers exist:
| first_name | last_name | admin | primary_email | primary_email | school |
| Jane | Doe | false | janedoe@berkeley.edu | jd@berkeley.edu | UC Berkeley |
| Jane | Doe | false | janedoe@berkeley.edu | jd@berkeley.edu | UC Berkeley |
| Bobby | John | false | bobbyjohn@berkeley.edu | bj@berkeley.edu | UC Berkeley |
Given I am on the BJC home page
And I have an admin email
Expand Down Expand Up @@ -437,14 +393,14 @@ Feature: basic admin functionality
And the following entries should exist in the teachers database:
| first_name | last_name | session_count | ip_history | last_session_at | admin | primary_email | school |
| Bobby | John | 534 | 1.2.3.4, 4.5.6.7, 7.8.9.10 | 2023-04-10 12:30:00 | false | bobbyjohn@berkeley.edu | UC Berkeley |

Scenario: Admin can access merge page from teacher show page
Given the following schools exist:
| 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 | admin | primary_email | school |
| Jane | Doe | false | janedoe@berkeley.edu | UC Berkeley |
| Jane | Doe | false | janedoe@berkeley.edu | UC Berkeley |
| Bobby | John | false | bobbyjohn@berkeley.edu | UC Berkeley |
Given I am on the BJC home page
And I have an admin email
Expand Down Expand Up @@ -490,9 +446,9 @@ Feature: basic admin functionality
Then I go to the show page for Jane Doe
When I attach the file with name "test_file.txt" on the show page
Then I see a confirmation "File was successfully uploaded"
When I click the first file deletion button
When I click the first file deletion button
And I accept the popup alert
Then I see a confirmation "File was successfully removed"
Then I see a confirmation "File was successfully removed"

# Scenario: Admin can import csv file. The loader should filter invalid record and create associate school.
# Given the following schools exist:
Expand Down
54 changes: 54 additions & 0 deletions features/data_tables.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Feature: Admin Data Tables functionality

As an admin
So that I can see how many people are teaching BJC
I can use interactive datatables

Background: Has an Admin in DB
Given the following teachers exist:
| first_name | last_name | admin | email |
| Admin | User | true | testadminuser@berkeley.edu |

Scenario: Updating application status persists changes in database
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
Given the following teachers exist:
| first_name | last_name | admin | primary_email | school | snap | application_status |
| Bobby | John | false | testteacher@berkeley.edu | UC Berkeley | bobby | denied |
Given I am on the BJC home page
And I have an admin email
And I follow "Log In"
Then I can log in with Google
When I go to the teachers page
And I go to the edit page for Bobby John
And I set my application status as "Validated"
And I press "Update"
Then I see a confirmation "Saved"
When I go to the teachers page
And I check "Validated"
Then I should see "Bobby John"

Scenario: Filter all teacher info as an admin
Given the following schools exist:
| name | country | city | state | website | grade_level | school_type |
| UC Berkeley | US | Berkeley | CA | https://www.berkeley.edu | university | public |
Given the following teachers exist:
| first_name | last_name | admin | primary_email | school | application_status |
| Victor | Validateme | false | testteacher1@berkeley.edu | UC Berkeley | Validated |
| Danny | Denyme | false | testteacher2@berkeley.edu | UC Berkeley | Denied |
| Peter | Pendme | false | testteacher3@berkeley.edu | UC Berkeley | Not Reviewed |
Given I am on the BJC home page
Given I have an admin email
And I follow "Log In"
Then I can log in with Google
When I go to the teachers page
And I check "Not Reviewed"
And I uncheck "Validated"
Then I should see "Peter"
Then I should not see "Victor"
Then I should not see "Danny"
And I check "Validated"
Then I should see "Peter"
Then I should see "Victor"
Then I should not see "Danny"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"popper.js": "^1.16.0",
"selectize": "^0.12.6",
"tinymce": "^5.x",
"trix": "^1.2.0",
"trix": "^2.1.1",
"turbolinks": "^5.2.0"
},
"devDependencies": {
Expand Down
21 changes: 13 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4560,6 +4560,11 @@ minipass@^3.0.0, minipass@^3.1.1:
dependencies:
yallist "^4.0.0"

minipass@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d"
integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==

minizlib@^2.1.1:
version "2.1.2"
resolved "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz"
Expand Down Expand Up @@ -6765,13 +6770,13 @@ tapable@^1.0.0, tapable@^1.1.3:
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==

tar@^6.0.2:
version "6.1.11"
resolved "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz"
integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
version "6.2.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a"
integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^3.0.0"
minipass "^5.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"
Expand Down Expand Up @@ -6902,10 +6907,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==

trix@^1.2.0:
version "1.3.1"
resolved "https://registry.npmjs.org/trix/-/trix-1.3.1.tgz"
integrity sha512-BbH6mb6gk+AV4f2as38mP6Ucc1LE3OD6XxkZnAgPIduWXYtvg2mI3cZhIZSLqmMh9OITEpOBCCk88IVmyjU7bA==
trix@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/trix/-/trix-2.1.1.tgz#688f1213601316cf8b92c5e625d2f562c118c780"
integrity sha512-IljOMGOlRUPg1i5Pk/+x/Ia65ZY7Gw5JxxKCh/4caxG5ZaKuFJCKdn1+TF0efUYfdg+bqWenB/mAYCHjZu0zpQ==

ts-pnp@^1.1.6:
version "1.2.0"
Expand Down

0 comments on commit 4272ddc

Please sign in to comment.