Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup schools bug fix #45

Merged
merged 15 commits into from
Apr 5, 2024
Merged

Cleanup schools bug fix #45

merged 15 commits into from
Apr 5, 2024

Conversation

ArushC
Copy link

@ArushC ArushC commented Mar 21, 2024

Pivotal Tracker Link

What this PR does:

This PR does three main things:

  1. fixes the Javascript that toggles the state "required" field when the country selected is/is not the USA, and fixes backend validations on the Schools#new and Schools#create pages.

  2. Adds two more backend tests for the international schools feature through the RSpec testing framework.

  3. Refactors ALL flash error messages in the application to adopt a standard format: "An error occured: [LIST OF ERRORS THAT OCCURED IN HUMAN-READABLE FORMAT]". I updated the Cucumber/RSpec tests accordingly. The error outputs are now considerably more informative than they were earlier ("Failed to submit information :(" does not tell me why the error occured).

I merged this PR directly into the international schools branch, for which a pull request to the Golden Repo is still open at beautyjoy#295.

This pull request fixes|implements (pick one...) ______.

Include screenshots, videos, etc.

Who authored this PR?

@ArushC

How should this PR be tested?

View the latest Heroku deployment, and look at the RSpec/Cucumber tests.

  • Is there a deploy we can view?

Yes: https://sp24-01-bjc-teachers-d0e972207d82.herokuapp.com/

EDIT: the current Heroku deployment contains the languages feature, not this one. Review that PR before this one and then force push this branch to the main on Heroku to deploy this.

  • What do the specs/features test?
  • Are there edge cases to watch out for?

Are there any complications to deploying this?

None

Checklist:

  • Has this been deployed to a staging environment or reviewed by a customer?
  • Tag someone for code review (either a coach / team member)
  • I have renamed the branch to match PivotTracker's suggested one (necessary for BlueJay) (e.g. michael/12345-add-new-feature Any branch name will do as long as the story ID is there. You can use git checkout -b [new-branch-name])

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

Attention: Patch coverage is 58.82353% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 86.03%. Comparing base (0480057) to head (809ce23).

Files Patch % Lines
app/controllers/teachers_controller.rb 33.33% 4 Missing ⚠️
app/controllers/schools_controller.rb 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
- Coverage   86.40%   86.03%   -0.37%     
==========================================
  Files          20       20              
  Lines         706      709       +3     
==========================================
  Hits          610      610              
- Misses         96       99       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@perryzjc perryzjc temporarily deployed to sp24-01-bjc-teachers March 21, 2024 23:37 Inactive
@ArushC
Copy link
Author

ArushC commented Apr 2, 2024

@perryzjc @razztech @JacksonXu33 @realmichaeltao someone please review this PR

@perryzjc perryzjc temporarily deployed to sp24-01-bjc-teachers April 2, 2024 18:40 Inactive
@perryzjc
Copy link
Member

perryzjc commented Apr 2, 2024

@ArushC Nice Job. I finished the review for this PR and pushed some commits to fix some of the issues. I also added a new test. There was one tricky thing my personal computer hard to verify. Take a look at my review for render 'new' && return above.

@ArushC
Copy link
Author

ArushC commented Apr 2, 2024

@perryzjc "Take a look at my review for render 'new' && return above" --> what does this mean? I don't see any review.

@perryzjc
Copy link
Member

perryzjc commented Apr 2, 2024

@perryzjc "Take a look at my review for render 'new' && return above" --> what does this mean? I don't see any review.

@ArushC Is this screenshot visible on your side?
image

@ArushC
Copy link
Author

ArushC commented Apr 2, 2024

wait that's so weird I literally don't see any review here... hmmm... ok well I'll take a look at that.

UPDATE: @perryzjc it looks fine to me. Check the latest heroku deployment to test. I forced pushed from this branch: https://sp24-01-bjc-teachers-d0e972207d82.herokuapp.com/teachers

@perryzjc perryzjc temporarily deployed to sp24-01-bjc-teachers April 2, 2024 23:00 Inactive
@@ -45,10 +45,11 @@ def update
@school = School.find(params[:id])
@school.assign_attributes(school_params)
if @school.save
flash[:success] = "Update #{@school.name} successfully."
flash[:success] = "Updated #{@school.name} successfully."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From codecov: Added line #L48 was not covered by tests

redirect_to school_path(@school)
else
render "edit", alert: "Failed to submit information :("
flash[:alert] = "An error occurred: #{@school.errors.full_messages.join(', ')}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added lines #L51 - L52 were not covered by tests

@@ -81,7 +81,7 @@ def create
TeacherMailer.teacher_form_submission(@teacher).deliver_now
redirect_to root_path
else
redirect_to new_teacher_path, alert: "An error occurred while trying to save. #{@teacher.errors.full_messages}"
redirect_to new_teacher_path, alert: "An error occurred: #{@teacher.errors.full_messages.join(', ')}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added line #L84 was not covered by tests

Copy link

@fp456 fp456 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but for the codecov alerts, I'm curious why there's no tests for the lines highlighted. Is it because it can't be tested? If it's feasible it would be reasonable to test that too. You can do it in another PR later if that's more convenient. Good job

@ArushC ArushC merged commit e2785ed into main Apr 5, 2024
8 checks passed
@ArushC ArushC deleted the cleanup-schools-bug-fix branch April 5, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants