Skip to content

Commit 65f6a53

Browse files
Non-active members are not required to complete a major project
1 parent b579158 commit 65f6a53

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

conditional/blueprints/major_project_submission.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from conditional.util.ldap import ldap_is_eval_director
1010
from conditional.util.ldap import ldap_get_member
11+
from conditional.util.ldap import ldap_is_active
1112
from conditional.util.flask import render_template
1213

1314
from conditional import db, start_of_year
@@ -57,17 +58,21 @@ def submit_major_project():
5758

5859
user_name = request.headers.get('x-webauth-user')
5960

60-
post_data = request.get_json()
61-
name = post_data['projectName']
62-
description = post_data['projectDescription']
61+
if ldap_is_active(user_name):
62+
post_data = request.get_json()
63+
name = post_data['projectName']
64+
description = post_data['projectDescription']
6365

64-
if name == "" or description == "":
65-
return jsonify({"success": False}), 400
66-
project = MajorProject(user_name, name, description)
66+
if name == "" or description == "":
67+
return jsonify({"success": False}), 400
68+
project = MajorProject(user_name, name, description)
6769

68-
db.session.add(project)
69-
db.session.commit()
70-
return jsonify({"success": True}), 200
70+
db.session.add(project)
71+
db.session.commit()
72+
return jsonify({"success": True}), 200
73+
else:
74+
# User is not an active member and does not need to complete a major project
75+
return jsonify({"success": False}, 403)
7176

7277

7378
@major_project_bp.route('/major_project/review', methods=['POST'])

conditional/templates/major_project_submission.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<div class="container main">
88
<h3 class="page-title">Major Project Form</h3>
9+
{% if is_active %}
910
<form data-module="majorProjectForm">
1011
<div class="panel panel-default">
1112
<div class="panel-body">
@@ -27,6 +28,11 @@ <h3 class="page-title">Major Project Form</h3>
2728
</div>
2829
<input class="btn btn-raised btn-primary" style="width:100%;margin-bottom:20px;" type="submit" value="Submit Major Project">
2930
</form>
31+
{% else %}
32+
<div class="alert alert-success" role="alert">
33+
<span class="glyphicon glyphicon-ok-sign"></span> You are not required to complete a major project.
34+
</div>
35+
{% endif %}
3036
<h3 class="page-title">All Major Projects</h3> {% if major_projects_len
3137
<=0 %} <div class="panel panel-default">
3238
<div class="panel-body">

0 commit comments

Comments
 (0)