Skip to content

Commit 5de400d

Browse files
authored
Merge pull request #356 from ComputerScienceHouse/develop
Conditional 1.11.0
2 parents 3ed2979 + 8e4d3ba commit 5de400d

12 files changed

+290
-40
lines changed

.github/workflows/python-app.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Install ldap dependencies
22-
run: sudo apt-get install libldap2-dev libsasl2-dev
22+
run: sudo apt-get update && sudo apt-get install libldap2-dev libsasl2-dev
2323
- uses: actions/checkout@v2
2424
- name: Set up Python ${{ matrix.python-version }}
2525
uses: actions/setup-python@v2

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
2525

2626
RUN ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
2727

28-
CMD ["gunicorn", "conditional:app", "--bind=0.0.0.0:8080", "--access-logfile=-", "--timeout=256"]
28+
CMD ["ddtrace-run", "gunicorn", "conditional:app", "--bind=0.0.0.0:8080", "--access-logfile=-", "--timeout=256"]

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ npm start
5757

5858
This will run the asset pipeline, start the Python server, and start BrowserSync. Your default web browser will open automatically. If it doesn't, navigate to `http://127.0.0.1:3000`. Any changes made to the frontend files in `frontend` or the Jinja templates in `conditional/templates` will cause the browser to reload automatically.
5959

60+
### Dependencies
61+
62+
To add new dependencies, add them to `requirements.in` and then run `pip-compile requirements.in` to produce a new locked `requirements.txt`. Do not edit `requirements.txt` directly as it will be overwritten by future PRs.
63+
6064
### Database Migrations
6165

6266
If the database schema is changed after initializing the database, you must migrate it to the new schema by running:

conditional/blueprints/major_project_submission.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
import structlog
1+
import json
2+
import requests
23

3-
from flask import Blueprint, request, jsonify, redirect
4+
from flask import Blueprint
5+
from flask import request
6+
from flask import jsonify
7+
from flask import redirect
48

59
from sqlalchemy import desc
610

11+
import structlog
12+
13+
from conditional.util.context_processors import get_member_name
14+
715
from conditional.models.models import MajorProject
816

917
from conditional.util.ldap import ldap_is_eval_director
1018
from conditional.util.ldap import ldap_get_member
1119
from conditional.util.flask import render_template
1220

13-
from conditional import db, start_of_year, get_user, auth
21+
from conditional import db, start_of_year, get_user, auth, app
1422

1523
logger = structlog.get_logger()
1624

@@ -61,6 +69,9 @@ def submit_major_project(user_dict=None):
6169
return jsonify({"success": False}), 400
6270
project = MajorProject(user_dict['username'], name, description)
6371

72+
username = user_dict['username']
73+
send_slack_ping({"text":f"<!subteam^S5XENJJAH> *{get_member_name(username)}* ({username})"
74+
f" submitted their major project, *{name}*!"})
6475
db.session.add(project)
6576
db.session.commit()
6677
return jsonify({"success": True}), 200
@@ -114,3 +125,6 @@ def major_project_delete(pid, user_dict=None):
114125
return jsonify({"success": True}), 200
115126

116127
return "Must be project owner to delete!", 401
128+
129+
def send_slack_ping(payload):
130+
requests.post(app.config['WEBHOOK_URL'], json.dumps(payload))

conditional/models/models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class CommitteeMeeting(db.Model):
5656
__tablename__ = 'committee_meetings'
5757
id = Column(Integer, primary_key=True)
5858
committee = Column(Enum('Evaluations', 'History', 'Social', 'Opcomm',
59-
'R&D', 'House Improvements', 'Financial', 'Chairman', 'Ad-Hoc', name="committees_enum"),
59+
'R&D', 'House Improvements', 'Financial',
60+
'Public Relations', 'Chairman', 'Ad-Hoc', name="committees_enum"),
6061
nullable=False)
6162
timestamp = Column(DateTime, nullable=False)
6263
approved = Column(Boolean, nullable=False)

conditional/templates/attendance_cm.html

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ <h3 class="page-title">Meeting Attendance</h3>
2323
<option value="Opcomm">OpComm</option>
2424
<option value="History">History</option>
2525
<option value="Social">Social</option>
26+
<option value="Public Relations">Public Relations</option>
2627
</select>
2728
</div>
2829
</div>

config.env.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
APP_NAME = "conditional"
1515
IP = env.get("CONDITIONAL_IP", "0.0.0.0")
1616
PORT = env.get("CONDITIONAL_PORT", 6969)
17+
WEBHOOK_URL = env.get("CONDITIONAL_WEBHOOK_URL", "INSERT URL HERE")
1718

1819
# DB Info
1920
SQLALCHEMY_DATABASE_URI = env.get("SQLALCHEMY_DATABASE_URI", "")
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Add PR
2+
3+
Revision ID: 757e18146d16
4+
Revises: 3eaae92ce6b3
5+
Create Date: 2022-09-07 12:13:17.966970
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = '757e18146d16'
11+
down_revision = '3eaae92ce6b3'
12+
13+
from alembic import op
14+
import sqlalchemy as sa
15+
from sqlalchemy.dialects import postgresql
16+
17+
18+
def upgrade():
19+
op.alter_column('committee_meetings', 'committee',
20+
existing_type=postgresql.ENUM('Evaluations', 'History', 'Social', 'Opcomm',
21+
'R&D', 'House Improvements', 'Financial', 'Public Relations', 'Chairman', 'Ad-Hoc', name="committees_enum"),
22+
nullable=False)
23+
24+
25+
def downgrade():
26+
op.alter_column('committee_meetings', 'committee',
27+
existing_type=postgresql.Enum('Evaluations', 'History', 'Social', 'Opcomm',
28+
'R&D', 'House Improvements', 'Financial', 'Chairman', 'Ad-Hoc', name="committees_enum"),
29+
nullable=False)

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "conditional",
3-
"version": "1.10.3",
3+
"version": "1.11.0",
44
"description": "CSH Re-evaluation (MEGA_EVALS RE:RE:LOADED)",
55
"license": "MIT",
66
"homepage": "http://csh.rit.edu/",
@@ -37,7 +37,7 @@
3737
"enumify": "^1.0.4",
3838
"jquery": "^3.1.0",
3939
"load-awesome": "^1.1.0",
40-
"lodash": "4.17.19",
40+
"lodash": "4.17.21",
4141
"reveal.js": "^3.3.0",
4242
"selectize": "^0.12.2",
4343
"selectize-scss": "^0.9.1",

requirements.in

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
alembic~=0.9.8
2+
astroid~=2.4.0
3+
blinker~=1.4
4+
click~=7.1
5+
csh_ldap>=2.3.1
6+
ddtrace~=1.1.4
7+
Flask~=1.1.4
8+
Flask-Migrate~=2.1.1
9+
Flask-Gzip~=0.2
10+
Flask-pyoidc~=1.3.0
11+
Flask-SQLAlchemy~=2.3.2
12+
gunicorn~=20.1.0
13+
isort~=4.3.4
14+
itsdangerous~=0.24
15+
Jinja2~=2.10
16+
lazy-object-proxy~=1.4.0
17+
Mako~=1.0.7
18+
MarkupSafe~=1.0
19+
mccabe~=0.6.1
20+
oic~=0.11.0
21+
pip-tools~=6.6.2
22+
psycopg2-binary~=2.9.3
23+
pylint~=2.6.0
24+
python-dateutil~=2.6.1
25+
python-editor~=1.0.3
26+
sentry-sdk[flask]~=0.19.5
27+
six~=1.12.0
28+
SQLAlchemy~=1.3.22
29+
structlog~=18.1.0
30+
Werkzeug~=0.15.3
31+
wrapt~=1.11.0

0 commit comments

Comments
 (0)