# Substitution-Requests

System for CSE 102 staff to request subs.

## Installing and configuring for the first time

### Install the libraries in your Python environment:
```
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
pip install --upgrade pandas
pip install --upgrade pysimplegui
```
Versions that are proven to work (newer versions probably work, older versions maybe work)

* Pysimplegui 4.60.4
* pandas: 1.4.4
* google-api-python-client 2.100.0
* google-auth-httplib2 0.1.1
* google-auth-oauthlib 0.5.2

### Install and configure Git
https://git-scm.com/downloads

Be sure to use the right version (32 vs 64 bit, Windows vs Linux, etc.)  you can find your version of Windows by typing “about” in the start bar

When installing Git, there are many settings, if you don’t know what it does, just keep the default option.

Run Git bash and within run this command:
```
git config --global core.autocrlf false
```

Close Git bash and open Git Gui

Click “Clone Existing Repository” and paste https://git.egr.msu.edu/CSE102/Substitution-Requests.git into the “Source Location” box.

The “Target Directory” box is the path to the folder you want to store your local copy in.  The folder must NOT already exist.
> (E.g. “C:\Users\USERNAME\Substitution-Requests” will create the Substitution Requests folder and put all the files inside it.)

Open the Repo in GitGui (this might happen automatically after cloning).  Click “Tools” and “Add”

Put “Pull” in the name box and “git pull origin master” (no quotes) in the command box and click “Add”

### Authenticate your machine with Google
Run the code for the first time (or since 7 days have elapsed since this step was last performed on this computer)

It will take you to a login page, you MUST log in as cse102msu@gmail.com (password is python_1107)

This login has mandatory 2-factor authentication (b/c of Google policy on API access)

So if this is the first time or if you've reset your browser cookies it will call the office phone in EGR 1107 to give you the code

Once logged in, just click continue on each increasingly dire warning page until it says “The authentication flow has completed. You may close this window”

## Daily Workflow:

Ensure that nobody else is currently working on these files or sitting on unpushed changes

> (This prevents merge conflicts and the need to redo work)

Open Git Gui and click "Tools" and "Pull" (or whatever you named the pull command during configuration explained above)

> (This updates your local copy to the repo's version)
	
run "driver.py" in your Python environment and when done, click "OK" to close and save changes

In Git Gui type a commit message and then click "Rescan", "Stage Changed", "Commit", and "Push" in that order.

Click "Push" in the dialog box that comes up, then close the confirmation dialog.