Skip to content

Conditional 1.5.0 #139

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

Merged
merged 26 commits into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0d64510
Miscellaneous fixes
mbillow Apr 27, 2017
e1d7072
Add conditional->eval relationship in DB
mbillow Apr 27, 2017
b0758ae
Link conditionals created during evaluations
mbillow Apr 27, 2017
6980d52
Add timestamp to major projects
mbillow May 22, 2017
4e9b599
Only show current year's worth of data
mbillow May 22, 2017
b20c083
Add Co-Op Submission Page
mbillow May 24, 2017
52b1fda
Add Semester Enum to Co-Op Table
mbillow May 24, 2017
3015a08
Update calculations based on new co-op changes
mbillow May 24, 2017
146a6e7
Easier to follow active member logic
mbillow May 27, 2017
2b69426
Eval director can delete co-ops now
mbillow May 28, 2017
205b00c
Better selection of radio buttons
mbillow May 28, 2017
894cb9e
Merge pull request #138 from mbillow/co-op
mbillow May 28, 2017
eaafd4d
Endpoints for clearing active group and rooms
mbillow May 29, 2017
16bed12
Add new year flow
mbillow Jun 17, 2017
699958c
Add current student pruning
mbillow Jun 17, 2017
163b39a
Merge pull request #143 from mbillow/new-year
mbillow Jun 18, 2017
ccb4bbe
Add Log Table
mbillow Jun 19, 2017
280eb5b
Change logging for all blueprints
mbillow Jun 19, 2017
9f71dce
Merge pull request #146 from mbillow/logging
mbillow Jun 21, 2017
0f9073d
Add user log page
mbillow Jun 21, 2017
2d06e8d
Parse Git Revision via Subprocess Call
liam-middlebrook Jun 29, 2017
7fb7270
Work on Become Active functionality
RamZallan Jul 19, 2017
8e62520
Change alert to panel-info
RamZallan Jul 19, 2017
297c766
Implement Become Active and Export All Active functionality
RamZallan Jul 24, 2017
0b4e619
Add DUES_PER_SEMESTER config instead of hardcoding
RamZallan Jul 25, 2017
57d4402
Merge pull request #147 from RamZallan/develop
mbillow Jul 25, 2017
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
62 changes: 56 additions & 6 deletions conditional/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import subprocess
from datetime import datetime
from flask import Flask, redirect, request, render_template, g
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
Expand All @@ -16,23 +17,68 @@
app.config.from_pyfile(config)
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False

try:
app.config["GIT_REVISION"] = fetch_git_sha(app.config["ROOT_DIR"])[:7]
except (InvalidGitRepository, KeyError):
app.config["GIT_REVISION"] = "unknown"
app.config["GIT_REVISION"] = subprocess.check_output(['git',
'rev-parse',
'--short',
'HEAD']).decode('utf-8').rstrip()


db = SQLAlchemy(app)
migrate = Migrate(app, db)
logger = structlog.get_logger()
sentry = Sentry(app)

ldap = CSHLDAP(app.config['LDAP_BIND_DN'],
app.config['LDAP_BIND_PW'],
ro=app.config['LDAP_RO'])

def start_of_year():
start = datetime(datetime.today().year, 6, 1)
if datetime.today() < start:
start = datetime(datetime.today().year-1, 6, 1)
return start

# pylint: disable=C0413
from conditional.models.models import UserLog

# Configure Logging
def request_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
if 'request' in event_dict:
flask_request = event_dict['request']
event_dict['user'] = flask_request.headers.get("x-webauth-user")
event_dict['ip'] = flask_request.remote_addr
event_dict['method'] = flask_request.method
event_dict['blueprint'] = flask_request.blueprint
event_dict['path'] = flask_request.full_path
return event_dict


def database_processor(logger, log_method, event_dict): # pylint: disable=unused-argument, redefined-outer-name
if 'request' in event_dict:
if event_dict['method'] != 'GET':
log = UserLog(
ipaddr=event_dict['ip'],
user=event_dict['user'],
method=event_dict['method'],
blueprint=event_dict['blueprint'],
path=event_dict['path'],
description=event_dict['event']
)
db.session.add(log)
db.session.flush()
db.session.commit()
del event_dict['request']
return event_dict

structlog.configure(processors=[
request_processor,
database_processor,
structlog.processors.KeyValueRenderer()
])

logger = structlog.get_logger()


from conditional.blueprints.dashboard import dashboard_bp
from conditional.blueprints.dashboard import dashboard_bp # pylint: disable=ungrouped-imports
from conditional.blueprints.attendance import attendance_bp
from conditional.blueprints.major_project_submission import major_project_bp
from conditional.blueprints.intro_evals import intro_evals_bp
Expand All @@ -43,6 +89,8 @@
from conditional.blueprints.member_management import member_management_bp
from conditional.blueprints.slideshow import slideshow_bp
from conditional.blueprints.cache_management import cache_bp
from conditional.blueprints.co_op import co_op_bp
from conditional.blueprints.logs import log_bp

app.register_blueprint(dashboard_bp)
app.register_blueprint(attendance_bp)
Expand All @@ -55,6 +103,8 @@
app.register_blueprint(member_management_bp)
app.register_blueprint(slideshow_bp)
app.register_blueprint(cache_bp)
app.register_blueprint(co_op_bp)
app.register_blueprint(log_bp)

from conditional.util.ldap import ldap_get_member

Expand Down
Loading