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

Conditional 1.11.0 #356

Merged
merged 12 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Install ldap dependencies
run: sudo apt-get install libldap2-dev libsasl2-dev
run: sudo apt-get update && sudo apt-get install libldap2-dev libsasl2-dev
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \

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

CMD ["gunicorn", "conditional:app", "--bind=0.0.0.0:8080", "--access-logfile=-", "--timeout=256"]
CMD ["ddtrace-run", "gunicorn", "conditional:app", "--bind=0.0.0.0:8080", "--access-logfile=-", "--timeout=256"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ npm start

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.

### Dependencies

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.

### Database Migrations

If the database schema is changed after initializing the database, you must migrate it to the new schema by running:
Expand Down
20 changes: 17 additions & 3 deletions conditional/blueprints/major_project_submission.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import structlog
import json
import requests

from flask import Blueprint, request, jsonify, redirect
from flask import Blueprint
from flask import request
from flask import jsonify
from flask import redirect

from sqlalchemy import desc

import structlog

from conditional.util.context_processors import get_member_name

from conditional.models.models import MajorProject

from conditional.util.ldap import ldap_is_eval_director
from conditional.util.ldap import ldap_get_member
from conditional.util.flask import render_template

from conditional import db, start_of_year, get_user, auth
from conditional import db, start_of_year, get_user, auth, app

logger = structlog.get_logger()

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

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

return "Must be project owner to delete!", 401

def send_slack_ping(payload):
requests.post(app.config['WEBHOOK_URL'], json.dumps(payload))
3 changes: 2 additions & 1 deletion conditional/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class CommitteeMeeting(db.Model):
__tablename__ = 'committee_meetings'
id = Column(Integer, primary_key=True)
committee = Column(Enum('Evaluations', 'History', 'Social', 'Opcomm',
'R&D', 'House Improvements', 'Financial', 'Chairman', 'Ad-Hoc', name="committees_enum"),
'R&D', 'House Improvements', 'Financial',
'Public Relations', 'Chairman', 'Ad-Hoc', name="committees_enum"),
nullable=False)
timestamp = Column(DateTime, nullable=False)
approved = Column(Boolean, nullable=False)
Expand Down
1 change: 1 addition & 0 deletions conditional/templates/attendance_cm.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h3 class="page-title">Meeting Attendance</h3>
<option value="Opcomm">OpComm</option>
<option value="History">History</option>
<option value="Social">Social</option>
<option value="Public Relations">Public Relations</option>
</select>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions config.env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
APP_NAME = "conditional"
IP = env.get("CONDITIONAL_IP", "0.0.0.0")
PORT = env.get("CONDITIONAL_PORT", 6969)
WEBHOOK_URL = env.get("CONDITIONAL_WEBHOOK_URL", "INSERT URL HERE")

# DB Info
SQLALCHEMY_DATABASE_URI = env.get("SQLALCHEMY_DATABASE_URI", "")
Expand Down
29 changes: 29 additions & 0 deletions migrations/versions/757e18146d16_add_pr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Add PR

Revision ID: 757e18146d16
Revises: 3eaae92ce6b3
Create Date: 2022-09-07 12:13:17.966970

"""

# revision identifiers, used by Alembic.
revision = '757e18146d16'
down_revision = '3eaae92ce6b3'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql


def upgrade():
op.alter_column('committee_meetings', 'committee',
existing_type=postgresql.ENUM('Evaluations', 'History', 'Social', 'Opcomm',
'R&D', 'House Improvements', 'Financial', 'Public Relations', 'Chairman', 'Ad-Hoc', name="committees_enum"),
nullable=False)


def downgrade():
op.alter_column('committee_meetings', 'committee',
existing_type=postgresql.Enum('Evaluations', 'History', 'Social', 'Opcomm',
'R&D', 'House Improvements', 'Financial', 'Chairman', 'Ad-Hoc', name="committees_enum"),
nullable=False)
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "conditional",
"version": "1.10.3",
"version": "1.11.0",
"description": "CSH Re-evaluation (MEGA_EVALS RE:RE:LOADED)",
"license": "MIT",
"homepage": "http://csh.rit.edu/",
Expand Down Expand Up @@ -37,7 +37,7 @@
"enumify": "^1.0.4",
"jquery": "^3.1.0",
"load-awesome": "^1.1.0",
"lodash": "4.17.19",
"lodash": "4.17.21",
"reveal.js": "^3.3.0",
"selectize": "^0.12.2",
"selectize-scss": "^0.9.1",
Expand Down
31 changes: 31 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
alembic~=0.9.8
astroid~=2.4.0
blinker~=1.4
click~=7.1
csh_ldap>=2.3.1
ddtrace~=1.1.4
Flask~=1.1.4
Flask-Migrate~=2.1.1
Flask-Gzip~=0.2
Flask-pyoidc~=1.3.0
Flask-SQLAlchemy~=2.3.2
gunicorn~=20.1.0
isort~=4.3.4
itsdangerous~=0.24
Jinja2~=2.10
lazy-object-proxy~=1.4.0
Mako~=1.0.7
MarkupSafe~=1.0
mccabe~=0.6.1
oic~=0.11.0
pip-tools~=6.6.2
psycopg2-binary~=2.9.3
pylint~=2.6.0
python-dateutil~=2.6.1
python-editor~=1.0.3
sentry-sdk[flask]~=0.19.5
six~=1.12.0
SQLAlchemy~=1.3.22
structlog~=18.1.0
Werkzeug~=0.15.3
wrapt~=1.11.0
Loading