Skip to content
This repository was archived by the owner on Apr 10, 2022. It is now read-only.

Commit b77c6fd

Browse files
authored
Merge pull request #87 from FSU-ACM/extra-credit-fall2018
Add extra-credit instructions, invoke lib
2 parents 18ad414 + f64a724 commit b77c6fd

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

docs/.vuepress/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module.exports = {
2626
'getting_started',
2727
'configuration',
2828
'deployment',
29+
'extra_credit',
2930
]
3031
},
3132
],

docs/guide/extra_credit.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Extra Credit
2+
The extra credit script is located in the project root, `extra_credit.py`.
3+
4+
For the script, you will need copies of the results (one for each division) and the extra credit survey. The script works by linking the score to the team, the team to the student, and the student to the courses. See comments in the script for further details.
5+
6+
## Setup
7+
There's two ways to run the extra credit script -- run it remotely in the Docker container for the webapp, or locally with a remote connection to the database.
8+
9+
Running locally means you need to configure Flask to connect to the database running on the remote host. This can be done by overriding your config to use an SSH tunnel which connects to the server DB. Since the default development config already points to `localhost:27017`, opening a tunnel there would be preferable. **Do not commit changes to the development config**.
10+
11+
### 1. Get the source files
12+
First, get a copy of the extra credit survey results. This should be a CSV where the second column (index 1) is an FSUID, and the third column (index 2) is a string of comma-delimted coursecodes (e.g. COP3014).
13+
14+
Next, download a copy of each division's results. You can find this under "Import/Export", then click the "results.tsv" link to download. Use the dropdown in the top right to switch between divisions.
15+
16+
Put these files somewhere the script can read them, i.e. if you're executing in the Docker container these need to be readable inside the container. Coping through the `share/` volume from the `docker-compose.yml` is a good way to transfer them. Consider storing them in the project root's `credit/` folder, as this path is ignored in the `.gitignore`. Furthermore, the script expects the survey CSV file to be stored as `credit/survey.csv`. Remember, **do not commit these files**.
17+
18+
### 2. Optional: Get inside the container
19+
If you're running the script from inside the container, you can enter the container using `docker-compose exec webapp bash` to create a bash terminal inside the container.
20+
21+
### 3. Run the script
22+
Using the `invoke` library, you can call the extra credit script very easily. See `tasks.py` for additional parameter details.
23+
24+
```sh
25+
$ inv extracredit -d upper -r credit/results_upper.tsv
26+
Reading results_tsv...
27+
Matching teams to scores...
28+
Reading extra credit survey...
29+
Writing class files...
30+
Processing orphan scores...
31+
```
32+
33+
This will spit out several CSVs under `{cwd}/credit/{division}`
34+

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ flask-nav==0.6
1919
Flask-ReCaptcha==0.4.2
2020
Flask-WTF==0.14.2
2121
html5lib==0.9999999
22+
invoke==1.2.0
2223
isort==4.3.2
2324
itsdangerous==0.24
2425
Jinja2==2.8

tasks.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from invoke import task
2+
from os import path, getcwd
3+
4+
@task
5+
def extracredit(
6+
c,
7+
division,
8+
results,
9+
survey=path.join('credit', 'survey.csv'),
10+
config=path.join('..', 'config', 'production.py'),
11+
):
12+
13+
output_folder = path.join(getcwd(), 'credit', division)
14+
15+
with c.prefix(f"export FLASK_CONFIG={config}"):
16+
c.run(f"mkdir -p {output_folder}")
17+
c.run(f"python extra_credit.py {results} {survey} {output_folder}")
18+

0 commit comments

Comments
 (0)