diff --git a/conditional/blueprints/attendance.py b/conditional/blueprints/attendance.py index 78a20e62..fe1bc94b 100644 --- a/conditional/blueprints/attendance.py +++ b/conditional/blueprints/attendance.py @@ -391,7 +391,7 @@ def get_seminar_attendees(meeting_id): user_name = request.headers.get('x-webauth-user') account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 page = request.args.get('page', 1) @@ -455,7 +455,7 @@ def alter_committee_attendance(cid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 post_data = request.get_json() meeting_id = cid @@ -488,7 +488,7 @@ def alter_seminar_attendance(sid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 post_data = request.get_json() meeting_id = sid @@ -528,7 +528,7 @@ def get_cm_attendees(sid): attendees.append(freshman) return jsonify({"attendees": attendees}), 200 - elif request.method == 'DELETE': + else: log = logger.new(request=request) log.info('Delete Technical Seminar {}'.format(sid)) @@ -536,7 +536,7 @@ def get_cm_attendees(sid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 FreshmanSeminarAttendance.query.filter( FreshmanSeminarAttendance.seminar_id == sid).delete() @@ -567,7 +567,7 @@ def get_ts_attendees(cid): attendees.append(freshman) return jsonify({"attendees": attendees}), 200 - elif request.method == 'DELETE': + else: log = logger.new(request=request) log.info('Delete Committee Meeting {}'.format(cid)) @@ -575,7 +575,7 @@ def get_ts_attendees(cid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 FreshmanCommitteeAttendance.query.filter( FreshmanCommitteeAttendance.meeting_id == cid).delete() @@ -599,7 +599,7 @@ def approve_cm(cid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 CommitteeMeeting.query.filter( CommitteeMeeting.id == cid).first().approved = True @@ -618,7 +618,7 @@ def approve_ts(sid): account = ldap_get_member(user_name) if not ldap_is_eboard(account): - return "must be eboard", 403 + return jsonify({"success": False, "error": "Not EBoard"}), 403 TechnicalSeminar.query.filter( TechnicalSeminar.id == sid).first().approved = True diff --git a/conditional/blueprints/cache_management.py b/conditional/blueprints/cache_management.py index 907b8a8b..3f179331 100644 --- a/conditional/blueprints/cache_management.py +++ b/conditional/blueprints/cache_management.py @@ -2,6 +2,8 @@ import signal import structlog +from flask import Blueprint, request, redirect + from conditional.util.ldap import ldap_is_eval_director from conditional.util.ldap import ldap_is_rtp @@ -17,8 +19,6 @@ from conditional.util.member import get_onfloor_members -from flask import Blueprint, request, redirect - logger = structlog.get_logger() cache_bp = Blueprint('cache_bp', __name__) diff --git a/conditional/blueprints/dashboard.py b/conditional/blueprints/dashboard.py index fe60b2bd..73bd2340 100644 --- a/conditional/blueprints/dashboard.py +++ b/conditional/blueprints/dashboard.py @@ -17,7 +17,7 @@ from conditional.util.housing import get_queue_position from conditional.util.flask import render_template -from conditional.util.member import get_freshman_data, get_voting_members, get_cm, get_hm +from conditional.util.member import get_freshman_data, get_voting_members, get_cm, get_hm, req_cm from conditional import start_of_year @@ -58,6 +58,7 @@ def display_dashboard(): spring = {} c_meetings = get_cm(member) spring['committee_meetings'] = len(c_meetings) + spring['req_meetings'] = req_cm(member) h_meetings = [(m.meeting_id, m.attendance_status) for m in get_hm(member)] spring['hm_missed'] = len([h for h in h_meetings if h[1] == "Absent"]) eval_entry = SpringEval.query.filter(SpringEval.uid == member.uid, diff --git a/conditional/blueprints/major_project_submission.py b/conditional/blueprints/major_project_submission.py index e8fd6be7..300b80de 100644 --- a/conditional/blueprints/major_project_submission.py +++ b/conditional/blueprints/major_project_submission.py @@ -2,6 +2,8 @@ from flask import Blueprint, request, jsonify, redirect +from sqlalchemy import desc + from conditional.models.models import MajorProject from conditional.util.ldap import ldap_is_eval_director @@ -9,7 +11,6 @@ from conditional.util.flask import render_template from conditional import db, start_of_year -from sqlalchemy import desc logger = structlog.get_logger() diff --git a/conditional/blueprints/spring_evals.py b/conditional/blueprints/spring_evals.py index 620a7164..326002e3 100644 --- a/conditional/blueprints/spring_evals.py +++ b/conditional/blueprints/spring_evals.py @@ -11,7 +11,7 @@ from conditional.util.flask import render_template -from conditional.util.member import get_cm, get_hm +from conditional.util.member import get_cm, get_hm, req_cm from conditional import db, start_of_year @@ -55,6 +55,7 @@ def display_spring_evals(internal=False): 'uid': uid, 'status': spring_entry.status, 'committee_meetings': len(get_cm(account)), + 'req_meetings': req_cm(account), 'house_meetings_missed': [ { diff --git a/conditional/templates/dashboard.html b/conditional/templates/dashboard.html index bc37db88..0b57fee6 100644 --- a/conditional/templates/dashboard.html +++ b/conditional/templates/dashboard.html @@ -127,9 +127,9 @@