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

CS169 Iteration 1 Pull Request #291

Closed
wants to merge 46 commits into from
Closed

CS169 Iteration 1 Pull Request #291

wants to merge 46 commits into from

Conversation

ArushC
Copy link
Contributor

@ArushC ArushC commented Mar 1, 2024

Pivotal Tracker Link

We decided to include the links to each of the pull requests that were made over the course of this iteration. See below. PRs are listed in chronological order, from earliest to most recent:

Change reason to denial reason: cs169#29

Add to field: cs169#30

Add email resend flash message: cs169#31

Add request more info feature as admin: cs169#32

Edit redirect to use current path: cs169#33

Fix email template reseed problem: cs169#34

What this PR does:

Implements iteration 1 features, including request more information button, the "to" field in the email template, and the flash message on resending emails. We also changed "reason" to "denial_reason" and fixed the duplicate email entry problem that occurs when you run "rails db:seed" after running migrations.

Include screenshots, videos, etc.

Who authored this PR?

  1. Arush Chhatrapati
  2. Perry (Jingchao) Zhong
  3. Michael Tao
  4. Jackson Xu
  5. Raz Turcu

How should this PR be tested?

See cucumber and RSpec tests, and view the latest deployment at https://sp24-01-bjc-teachers-d0e972207d82.herokuapp.com/dashboard.

Are there any complications to deploying this?

Basically no, but if there are any potential risks, the update feature of reseed might overwrite the old email templates in the database if the hashed values are the same.

Run "rails db:migrate" and "rails db:seed".

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])

cycomachead and others added 30 commits February 12, 2024 11:02
Allow manually triggering specs
…flash-message

Feature/187044317 add email resend flash message
Add request more info feature as an admin
@perryzjc
Copy link
Contributor

perryzjc commented Mar 2, 2024

A new PR just merged into cs169's main branch, which fixes the implementation & tests for email reseed problem we discussed last Friday (Mar 1).

@fp456
Copy link

fp456 commented Mar 4, 2024

Looks good so far but we can add more testing, especially for "Add request more info feature as admin".

Copy link
Member

@cycomachead cycomachead left a comment

Choose a reason for hiding this comment

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

Some initial comments

@@ -146,7 +146,8 @@ def deny
@teacher.denied!
if !params[:skip_email].present?
# TODO: Update dropdown to select the email template.
TeacherMailer.deny_email(@teacher, params[:reason]).deliver_now
puts params[:denial_reason]
Copy link
Member

Choose a reason for hiding this comment

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

Please clean this up. :)

@@ -1,7 +1,10 @@
<%# This part of the page is the email template form %>
Copy link
Member

Choose a reason for hiding this comment

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

I would delete a comment like this.

@@ -0,0 +1,5 @@
class ChangeToFieldForFormSubmission < ActiveRecord::Migration[6.1]
Copy link
Member

Choose a reason for hiding this comment

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

We should delete this file, or move it to a lib folder.

class AddToFieldToEmailTemplate < ActiveRecord::Migration[6.1]
def change
add_column :email_templates, :to, :string
#below is the default prepopulated 'to' field value,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think Rails migrations should be used to change data, only the schema.

We should move this to the data migrating to a lib file or just to document what admins might need to do.

Copy link
Contributor

@perryzjc perryzjc Mar 8, 2024

Choose a reason for hiding this comment

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

During the class discussion, Michael thought we could just skip the migration for this part; he could just manually update the field.

At the new pull request, we may want to include this info for the migration note for the new PR, e.g. optionally to change the to field of email template in that format

@@ -2,7 +2,12 @@

require_relative "seed_data"

SeedData.emails.each { |email| EmailTemplate.find_or_create_by(email) }
SeedData.emails.each do |email_attrs|
# Based on what Professor Ball mentioned, 'title' is the unique identifier for each EmailTemplate
Copy link
Member

Choose a reason for hiding this comment

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

Comments like this read a little funny. :)

{ title: email_attrs[:title] } can just be passed directly to the find function

more_info: ''
application_status: Denied
school: berkeley
education_level: -1
Copy link
Member

Choose a reason for hiding this comment

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

This file should end with a new line.

case "deny":
newAction = `/teachers/${teacherId}/deny`;
newTitle = 'Deny ' + teacherName;
inputName = 'denial_reason'; // The dynamic part for the input's name attribute
Copy link
Member

Choose a reason for hiding this comment

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

Delete the comment at the end of the line.

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.77%. Comparing base (0f79f52) to head (df52d67).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #291      +/-   ##
==========================================
+ Coverage   81.95%   85.77%   +3.82%     
==========================================
  Files          20       20              
  Lines         654      668      +14     
==========================================
+ Hits          536      573      +37     
+ Misses        118       95      -23     

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

@ArushC ArushC closed this Mar 8, 2024
@ArushC ArushC mentioned this pull request Mar 8, 2024
3 tasks
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.

7 participants