Rev Registration
Description
Rev Registration is an automatic class scheduler for Texas A&M, aimed at easing the process of course registration by generating compatible schedules given the courses a student would like to take and what preferences they have. Simply select a term, pick your courses, mark off when you're not available, and we'll generate schedules for you!
For instance, imagine you've settled on 3 sections of a course you are fine with having and are having trouble finding a schedule without conflicts. Select all 3 under the Section customization level, add in your other classes, and let the schedule generator create schedules for you without time conflicts!
Features:
- Automatic schedule generation
- Block off busy times (availabilities)
- Displays grade distribution
- Shows current seats remaining
- Search by course number or title
- Filter for only honors or online sections
- Visual display of schedules
- Remembers preferences for easy access during registration
- Login with Google
- Save, rename, and delete generated schedules
- Filter out full sections
Installation
Follow these steps to start a local Django server using a PostgreSQL database:
-
For Windows, use powershell instead of command prompt.
- Some commands don't always work on command prompt.
-
If you don’t have it already, download Python from here.
-
Clone the current project:
git clone https://github.com/aggie-coding-club/Rev-Registration.git
- This will clone the project into the current directory
-
Make a virtual Python environment:
python3 -m venv env
- It is recommended to put the virtual environment in the root directory:
./Rev-Registration
- Help us ensure that our libraries & Python versions are unified.
- This creates a virtual environment in the
env/
folder. - In here you'll see a directory containing the libraries that will be installed in the next step(
Lib/
on Windows) - You'll also see a folder(
Scripts/
on Windows &bin/
on Unix systems) that contains the scripts that you need to start the virtual environment. - Depending on your Python version, you may have to replace the
python3
in all commands with eitherpython
orpy
. (aliases)- Error:
The term 'python3' is not recognized as the name of a cmdlet, function, script file, or operable program.
- Error:
- This creates a virtual environment in the
- Next, for Unix systems run:
source env/bin/activate
- And for Windows, in Powershell run:
./env/Scripts/activate
- If you get a permissions error that says:
execution of scripts is disabled on this system
, then open another PowerShell as Administrator and runSet-ExecutionPolicy -ExecutionPolicy RemoteSigned
.- Alternatively, you can just run the original script as Administrator.
- If you get a permissions error that says:
- You will need to do
source env/bin/activate
or./env/Scripts/activate
anytime you want to interact with the server(i.e. to run it withpython manage.py runserver
)
- It is recommended to put the virtual environment in the root directory:
-
Now, run
pip install -r autoscheduler/requirements.txt
to install the necessary packages for the project. -
Set up a PostgresQL server by following one of these guides, and make sure you set the name of the database to
dbautoscheduler
when prompted: -
(Only if using pgAdmin) Create a new server by opening pgAdmin and right-click “Servers->Create->Server…”. Set a name pgAdmin will use (it can be anything), then change to the Connection tab. Ensure the following settings are being used:
Host name/address: localhost
Port: 5432
Maintenance database: postgres
Username: postgres
Password: (not necessary)
-
Ensure the database
dbautoscheduler
has been created: Using psql: Type\l
in the psql prompt and see ifdbautoscheduler
is in the list. Using pgAdmin: Click the name of the server you created, and see ifdbautoscheduler
is in the tree menu. -
Navigate to the frontend directory:
./autoscheduler/frontend/src/
and runnpm install
to install our frontend dependencies -
Before making code changes, please go to the Github project wiki and follow the Project Setup and Install section.
Running
Before running any commands, if you're not running in the virtual environment(you should see (env)
somewhere in your current terminal line), run source env/bin/activate
or ./env/Scripts/activate
.
Backend:
-
You will have to make and apply migrations before running the server (and whenever our models are changed). To apply migrations to your database, run
python3 ./manage.py migrate
manage.py
can be found in the./autoscheduler/
directory.
-
You'll also need to make a
.env
file inautoscheduler/autoscheduler/settings/
which contains our client ID and secret for Google OAuth. As these are private values, you'll need to ask one of the members for it. -
After migrating, you can run the server with
python3 ./manage.py runserver
. When running for the first time, you will have to configureautoscheduler/autoscheduler/config/postgres-info.json
with your postgres username and password. This file will be automatically created if you runpython3 ./manage.py runserver
.- This starts a webserver that's listening on port 8000, so you can navigate to
localhost:8000/
and you should see the landing page- Note: you must have run
npm run dev
from below
- Note: you must have run
- This starts a webserver that's listening on port 8000, so you can navigate to
-
If
python3 ./manage.py
isn't working, try to usepython manage.py ...
orpy ./manage.py ...
or./manage.py ...
in place of it.- See python aliases above
Scraping Course Info:
The first time you run the server, you will need to scrape the course info from TAMU:
Scraping command arguments:
- Please run these commands in the given order
python manage.py scrape_depts
-t [term]
or--term [term]
- e.g.
scrape_depts -t 202031
- e.g.
python manage.py scrape_courses
-t [term]
or--term [term]
- e.g.
scrape_courses -t 202031
- e.g.
-y [year]
or--year [year]
- e.g.
scrape_courses -y 2020
- Scrapes all semesters + locations for the given year
- e.g.
-r
or--recent
- e.g.
scrape_courses -r
- Scrapes the most recent terms. E.g. if it's October 1st 2020, it will scrape Summer + Fall 2020 for all locations
- e.g.
-t
,-y
, and-r
are mutually exclusive
python manage.py scrape_grades
-y [year]
or--year [year]
- e.g.
scrape_grades -y 2020
- e.g.
-r
or--recent
-d
or--discord
-c [college]
or--college [college]
- e.g.
scrape_grades -c EN
- e.g.
-p [procs]
or--procs [procs]
- e.g.
scrape_grades -p 5
scrape_grades
uses multi-processing, and this changes how many processes run at a time. Defaults to the number of cores your CPU has.
- e.g.
- Note that all of
scrape_grades
arguments can be used at the same time, except for--year
and--recent
Frontend:
- Navigate to the frontend source directory:
cd ./autoscheduler/frontend/src
and runnpm run dev
- This sets up a watch for file changes and compiles them
- If you already have
python manage.py runserver
running, you can see the server atlocalhost:8000/
and refresh after you change files andnpm run dev
re-compiles them. - ctrl-c to quit
Testing:
- The frontend has automated test suites which can be run with:
cd ./autoscheduler/frontend/src
npm run test
- Can put filename after to test only one file:
npm run test testfile.test.tsx
- It is possible that you will need the relative filepath in front of the
testfile.test.tsx
, while on other systems you can't have it.
- It is possible that you will need the relative filepath in front of the
- Can put filename after to test only one file:
- If that doesn't work try:
npx jest <filename>