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

See what's changed in upstream 61A #49

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
188cc23
provide sensible oauth defaults
rahularya50 Feb 17, 2020
b59f38a
removed google API, switched to Auth
rahularya50 Feb 17, 2020
94b96e3
refactored templates, implemented exam selection view
rahularya50 Feb 17, 2020
3a06be4
added link back to homepage
rahularya50 Feb 17, 2020
0d0df04
ability to create new exams
rahularya50 Feb 18, 2020
7c528bb
added ability to delete exams
rahularya50 Feb 18, 2020
a728c0e
authenticate properly
rahularya50 Feb 18, 2020
126726e
Ability to choose which exam is live.
rahularya50 Feb 18, 2020
138fec2
pin dep
rahularya50 Feb 18, 2020
c3790b2
remove f-string
rahularya50 Feb 18, 2020
f4aca91
added photo upload functionality
rahularya50 Feb 18, 2020
2bd0024
update README
rahularya50 Feb 18, 2020
e5ee6b4
added debug
rahularya50 Feb 18, 2020
613e32c
remove debug
rahularya50 Feb 18, 2020
b1a8d3d
Merge pull request #10 from Cal-CS-61A-Staff/pin-werkzeug
rahularya50 Feb 18, 2020
c98ad73
stuff
rahularya50 Feb 19, 2020
ac5c8b5
Merge pull request #11 from Cal-CS-61A-Staff/seating-revamp
chrononyan Feb 19, 2020
746b2f3
Hide links in frontend based on admin status
rahularya50 Feb 20, 2020
7badb48
added flag to missing templates
rahularya50 Feb 20, 2020
44124d4
added flag to missing templates
rahularya50 Feb 20, 2020
4c22a27
Merge branch 'auth-admin' of https://github.com/Cal-CS-61A-Staff/seat…
rahularya50 Feb 25, 2020
e02bddd
updated is_admin
rahularya50 Feb 27, 2020
9dd5428
Update README.md
itsnshaw Feb 28, 2020
3c8da46
Reassign seat assignments
itsnshaw Feb 28, 2020
7f122e3
bug fix
itsnshaw Feb 28, 2020
db99132
check if assigned seat
itsnshaw Feb 28, 2020
bb6fee7
Merge pull request #13 from Cal-CS-61A-Staff/reassign
itsnshaw Feb 28, 2020
6bacaa6
Add clearer error msg for auth
itsnshaw Feb 28, 2020
17583e2
Merge branch 'reassign'
itsnshaw Feb 28, 2020
3261df0
Add student count per room
itsnshaw Feb 28, 2020
91729e9
Merge pull request #14 from Cal-CS-61A-Staff/studentcount
itsnshaw Feb 28, 2020
d4c0ee5
Update README.md
itsnshaw Feb 28, 2020
d48720b
Fix validation URL
itsnshaw Feb 28, 2020
27577a4
tweaked text
rahularya50 Feb 29, 2020
8d6329c
Merge branch 'master' of https://github.com/Cal-CS-61A-Staff/seating …
rahularya50 Feb 29, 2020
3a8e97d
add debug
rahularya50 Mar 2, 2020
0c66b6a
fix image bug
rahularya50 Mar 2, 2020
378ab50
typo
rahularya50 Mar 2, 2020
83cbdc2
bump
rahularya50 Mar 2, 2020
110edf3
Merge pull request #12 from Cal-CS-61A-Staff/auth-admin
rahularya50 Mar 2, 2020
8d02250
feat: switch to a super-client
rahularya50 Apr 21, 2020
6d36852
Avoid encoding= parameter in json.load() as it has been deprecated
Feb 20, 2022
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
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn -b 0.0.0.0:$PORT server:app
web: gunicorn --workers 8 --timeout 240 -b 0.0.0.0:$PORT server:app
37 changes: 11 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ and students with the appropriate roles.

## Usage (Admin TAs for Courses)

It's janky. Many steps involve directly poking the database. The only way to
correct errors is to manually edit the database, so be careful.

In summary, setting up the seating chart involves these steps:
1. **Create an exam** (ex. Midterm 1 or Final). Or at least in the future you will be able to.
For now, contact the slack to have your exam created for you if you did not set up the app.
This step is already done for you if you can successfully view the seating app.
0. **Register your course** on [auth.apps.cs61a.org], specifying your OKPy endpoint, and adding your desired domain for the seating app. Then contact us to activate the seating app for that domain.
1. **Create an exam** (ex. Midterm 1 or Final).
2. **Add rooms.** Choose your rooms from our selection or import your own custom room.
3. **Import students.** Customize your student preferences (left seat, front/back, buildings, etc.)
4. **Assign! Then email!**
Expand Down Expand Up @@ -57,7 +53,7 @@ you adding the sheet to the [master doc](https://drive.google.com/open?id=1cHKVh

To import students, create a Google spreadsheet with the columns "Name",
"Student ID", "Email", and "bCourses ID". The remaining columns are arbitrary attributes
(ex: LEFTY, RIGHTY, BROKEN) that express student preferences.
(ex: LEFTY, RIGHTY, BROKEN) that express student preferences. This spreadsheet must be shared with the 61A service account [[email protected]](mailto:[email protected]).

For example, if a student has LEFTY=TRUE, they will be assigned a seat with the
LEFTY attribute. If a student has LEFTY=FALSE, they will be assigned a seat
Expand Down Expand Up @@ -117,8 +113,6 @@ cheaters.

Viewing full seating charts requires logging in as a TA or tutor through Ok.

Importing spreadsheets requires a separate Google OAuth login.

All paths at an exam route (e.g. `/cal/cs61a/fa17/midterm1`) require a proper
staff login.

Expand All @@ -127,14 +121,11 @@ a room's full seating chart without displaying any student info or info about
seat assignments.

When a student attempts to log in, they will be redirected to their assigned
seat page if it exists. This only works for the current COURSE and EXAM as
set in the environment variables.
seat page if it exists.

### Creating exams

Create an exam by adding a row to the `exams` table. The exam that the home page
redirects to is hardcoded, so you may want to change that too. In the future,
there should be an interface to CRUD exams.
Create an exam by pressing `Add Exam` on the home page. Click the star next to an exam to mark it as `Active`, so students can see their seat for that exam.

## Setup (development)
1. Clone the repository and change directories into the repository.
Expand Down Expand Up @@ -162,7 +153,7 @@ export FLASK_APP = server (or server/__init__.py)
export FLASK_ENV = development
```

6. Modify `config.py` as necessary. Set `OK_CLIENT_ID`, `OK_CLIENT_SECRET`, `GOOGLE_OAUTH2_CLIENT_ID`, `GOOGLE_OAUTH2_CLIENT_SECRET`, `SENDGRID_API_KEY`, `PHOTO_DIRECTORY`, `EXAM`, `ADMIN` as needed.
6. Modify `config.py` as necessary. Set `AUTH_KEY`, `AUTH_CLIENT_SECRET`, `SENDGRID_API_KEY`, `PHOTO_DIRECTORY`, `ADMIN` as needed.

7. Import [demo data](https://docs.google.com/spreadsheets/d/1nC2vinn0k-_TLO0aLmLZtI9juEoSOVEvA3o40HGvXAw/edit?usp=drive_web&ouid=100612133541464602205) for students and rooms (photos TBA).

Expand All @@ -174,6 +165,8 @@ This commands only needs to be run once.

6. Open [localhost:5000](https://localhost:5000)

## Production (Adding Another Class)
Update configs at https://auth.apps.cs61a.org/ where relevant

## Production (First Time Deployment on dokku)
dokku apps:create seating
Expand All @@ -191,12 +184,7 @@ This commands only needs to be run once.
dokku run seating flask initdb
dokku letsencrypt seating

In addition, add the following to `/home/dokku/seating/nginx.conf`:
```
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
```
Also update any necessary configurations on GCLOUD. (There will be a linked URL).

## Environment variables
```
Expand All @@ -205,11 +193,8 @@ SECRET_KEY
DATABASE_URL
OK_CLIENT_ID
OK_CLIENT_SECRET
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
COURSE
EXAM
DOMAIN
AUTH_KEY
AUTH_CLIENT_SECRET
PHOTO_DIRECTORY=/app/storage
ADMIN
```
Expand Down
22 changes: 9 additions & 13 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Define the application directory
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

# Define the database
# We are working with SQLite for development, mysql for production
# Define the database
# We are working with SQLite for development, mysql for production
# [development should be changed to mysql in the future]
if os.getenv('FLASK_ENV') == 'development':
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'app.db')
Expand All @@ -16,21 +16,17 @@

# Configure other environment variables

OK_CLIENT_ID = os.getenv('OK_CLIENT_ID')
OK_CLIENT_SECRET = os.getenv('OK_CLIENT_SECRET')
OK_CLIENT_ID = os.getenv('OK_CLIENT_ID', "local-dev-all")
OK_CLIENT_SECRET = os.getenv('OK_CLIENT_SECRET', "kmSPJYPzKJglOOOmr7q0irMfBVMRFXN")

GOOGLE_OAUTH2_CLIENT_ID = os.getenv('GOOGLE_CLIENT_ID')
GOOGLE_OAUTH2_CLIENT_SECRET = os.getenv('GOOGLE_CLIENT_SECRET')
AUTH_KEY = os.getenv("AUTH_KEY", "seating-app")
AUTH_CLIENT_SECRET = os.getenv("AUTH_CLIENT_SECRET")

# Email setup. Domain environment is for link in email.
SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY')
DOMAIN = os.getenv('DOMAIN', 'https://seating.test.org')

PHOTO_DIRECTORY = os.getenv('PHOTO_DIRECTORY')

# Used for redirects and auth: <domain>/COURSE/EXAM
COURSE = os.getenv('COURSE', 'cal/test/fa18')
EXAM = os.getenv('EXAM')
# Must be an absolute path
PHOTO_DIRECTORY = os.getenv('PHOTO_DIRECTORY', os.path.join(BASE_DIR, "storage"))

TEST_LOGIN = os.getenv('TEST_LOGIN')

Expand Down
Loading