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

Awstesting #14

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added FAQ.assets/image-20240117-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FAQ.assets/image-20240117-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This page will list out quick responses, common bugs and their fixes, as well as
## After walking through [GETTING_STARTED.md](https://github.com/cs161-staff/extensions/blob/master/GETTING_STARTED.md)
* [The Form Responses tab is filling, but the Roster tab is not](#the-form-responses-tab-is-filling-but-the-roster-tab-is-not)
* [I need to change the name of the slack channel](#i-need-to-change-the-name-of-the-slack-channel)
* [I want to add custom comments without copy-pasting](#I-want-to-add-custom-comments-without-copy-pasting)
## Error messages
* ["Student \<name\> responded '' to DSP question in extension request, but is not marked for DSP approval on the roster. Please investigate!"](#snr)
* ["Error: ('An error occurred while sending an email:', Exception(... Insufficient system storage', '[email protected]'))"](#cs162)
Expand All @@ -35,6 +36,15 @@ This page will list out quick responses, common bugs and their fixes, as well as
### I need to change the name of the slack channel
>No problem! Changing the name of the slack channel where the webhook points will not affect it. You should be able to do this with no consequences.

### I want to add custom comments without copy-pasting
>You can take advantage of google sheets to do this! On a separate tab, type out any comments you want to be able to toggle off and on for any given email.
![image-20240117-1](FAQ.assets/image-20240117-1.png)

>Back in the roster tab, create two new columns. In one of the columns, column 1, insert a checkbox. In the other column, column 2, you can use the formula `IF(\<cell from column 1\>, \<cell of comment\>, "")`. If you want multiple comments you can use concatenate.
![image-20240117-1](FAQ.assets/image-20240117-2.png)

>To include the comment, toggle on the check box. If the checkbox is unchecked, the formula above will include an empty string instead of the comment.

<div id="snr"></div>

### "Student \<name\> responded '' to DSP question in extension request, but is not marked for DSP approval on the roster. Please investigate!"
Expand Down
2 changes: 1 addition & 1 deletion GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _Estimated Time: 10 minutes_
1. Make a copy of [this spreadsheet](https://docs.google.com/spreadsheets/d/1BabID1n6fPgeuuO4-1r3mkoQ9Nx5dquNwdsET75In1E/edit?usp=sharing). Make sure to rename it to "CS \_\_\_ SP22 Extensions Backend"
2. Delete the “Form Responses” sheet within the spreadsheet.
3. Share the spreadsheet with [[email protected]](mailto:[email protected]). This allows our hosted cloud function to read/write to your sheet. (If you're self-hosting, this should be your service account email.)
4. Make a copy of [this form](https://docs.google.com/forms/d/1_9XobNT4R3z_bhlrVEUqMP92Bxa9W5FsedNngZuGwXc/edit?usp=sharing). Make sure to rename it. Close the form template, so you don't accidentally edit it.
4. Make a copy of [this form](https://docs.google.com/forms/d/1uc9NUwxLnfTc1Zlv0Dec1A1Jsu5UYR7-0K2kfTR0Zqs/edit). Make sure to rename it. Close the form template, so you don't accidentally edit it.
5. On the form, in the "Responses" tab, configure the form responses to be written to the Extensions Backend spreadsheet.
- This should create a new tab within the Extensions Backend sheet.
- Rename the tab to “Form Responses”.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The CS 161 Extensions Pipeline is a lightweight framework designed for tracking,

At a high level, this pipeline consists of:

- A **[Google Form](https://forms.gle/m25EswwXMpq6vqrp7)** that students submit extension requests to.
- A **[Google Form](https://docs.google.com/forms/d/e/1FAIpQLSfrlZXWRdllpkllha9Abfib57qJcKrRfeHHW3kSmA2b3FZ_QA/viewform?usp=sf_link)** that students submit extension requests to.
- A **[Google Sheet](https://docs.google.com/spreadsheets/d/1BabID1n6fPgeuuO4-1r3mkoQ9Nx5dquNwdsET75In1E/edit#gid=790260459)** that collects student extension requests and tracks all extension requests in a master roster.
- A **Google Cloud Function** that contains core business logic that:
- Receives form data through a simple **Google Apps Script** trigger.
Expand All @@ -22,7 +22,7 @@ Traditionally, courses deal with two types of extensions –
1. **DSP Extensions**, for students with accommodations for assignment extensions
2. **Non-DSP Extensions**, for students facing extenuating or otherwise unforeseen circumstances

Courses traditionally collect extension requests through Google Forms (e.g. ones provided by course managers, like [this one](https://docs.google.com/forms/d/e/1FAIpQLSek1NWhh6ERQsMJqbkFhv9JtNUPBQsJ3YSoo9uqsFGJ2Lb2iA/viewform)) or via email. In order to approve these extensions, however, courses (or course managers) need to:
Courses traditionally collect extension requests through Google Forms (e.g. ones provided by course managers, like [this one](https://docs.google.com/forms/d/e/1FAIpQLSfrlZXWRdllpkllha9Abfib57qJcKrRfeHHW3kSmA2b3FZ_QA/viewform?usp=sf_link)) or via email. In order to approve these extensions, however, courses (or course managers) need to:

- Read the student's request and categorize it into a DSP or Non-DSP extension.
- Look up whether the student has previously requested assignment extensions.
Expand All @@ -43,7 +43,7 @@ The CS 161 Extension Pipeline addresses all of these challenges, significantly *

# Our Pipeline: Student Workflow

Students request an extension through a Google Form (see an example [here](https://docs.google.com/forms/d/e/1FAIpQLScearqptcOVkcmneQ97zJ07i-r_dtokwhb2rAtTv_WK6a2nJw/viewform)).
Students request an extension through a Google Form (see an example [here](https://docs.google.com/forms/d/e/1FAIpQLSfrlZXWRdllpkllha9Abfib57qJcKrRfeHHW3kSmA2b3FZ_QA/viewform?usp=sf_link)).

**If a student knows which assignments they want to request an extension on,** then they're prompted to select from a list of assignments, and provide a number of days for each extension. They can either enter a single number (which will apply to all assignments that they select), or enter comma-separated numbers (to allow them to request a different number of days for different assignments).

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ attrs==21.4.0
autopep8==1.6.0
beautifulsoup4==4.10.0
black==21.12b0
boto3==1.0.0
bs4==0.0.1
cachetools==4.2.4
certifi==2021.10.8
Expand Down
49 changes: 48 additions & 1 deletion src/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import os
from datetime import datetime, timedelta
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formataddr
from smtplib import SMTP_SSL, SMTPException
from typing import List

from sicp.common.rpc.mail import send_email
Expand Down Expand Up @@ -99,7 +103,7 @@ def fmt_date(dt: datetime):
body=body,
)

def send(self) -> None:
def OLDsend(self) -> None:
# TODO: When 162 adds HTML support, bring back HTML emails.
# html_body = Markdown().convert(self.body)
# extra_headers = [("Content-Type", "text/html; charset=UTF-8")]
Expand All @@ -125,3 +129,46 @@ def send(self) -> None:

except Exception as e:
raise EmailError("An error occurred while sending an email:", e)


def send(self) -> None:
PORT = 465 # For starttls
HOST = "REDACTED"
username = "REDACTED"
sender_email = "REDACTED"
SENDERNAME = Environment.get(ENV_EMAIL_FROM)
receiver_email = self.to_email
cc_emails = self.cc_emails
reply_to_email = self.reply_to_email
password = "REDACTED"
SUBJECT = self.subject
# message = """\
# Subject: Hi there

# This message is sent from Python."""

BODY_TEXT = ("BCOP TEST TEST")

msg = MIMEMultipart('alternative')
msg['Subject'] = SUBJECT
msg['From'] = formataddr((SENDERNAME, sender_email))
msg['To'] = receiver_email
msg.add_header('reply-to', reply_to_email)
if len(cc_emails) > 0:
msg['CC'] = ",".join(cc_emails)
# Comment or delete the next line if you are not using a configuration set
# msg.add_header('X-SES-CONFIGURATION-SET',CONFIGURATION_SET)

# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(self.body, 'plain')

# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part1)

with SMTP_SSL(HOST, PORT) as server:
server.login(username, password)
server.sendmail(sender_email, [receiver_email]+cc_emails, msg.as_string())
server.close()
print("Email sent!")