Skip to content

Non-active members are not required to complete a major project #166

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
23 changes: 14 additions & 9 deletions conditional/blueprints/major_project_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

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

from conditional import db, start_of_year
Expand Down Expand Up @@ -57,17 +58,21 @@ def submit_major_project():

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

post_data = request.get_json()
name = post_data['projectName']
description = post_data['projectDescription']
if ldap_is_active(user_name):
post_data = request.get_json()
name = post_data['projectName']
description = post_data['projectDescription']

if name == "" or description == "":
return jsonify({"success": False}), 400
project = MajorProject(user_name, name, description)
if name == "" or description == "":
return jsonify({"success": False}), 400
project = MajorProject(user_name, name, description)

db.session.add(project)
db.session.commit()
return jsonify({"success": True}), 200
db.session.add(project)
db.session.commit()
return jsonify({"success": True}), 200
else:
# User is not an active member and does not need to complete a major project
return jsonify({"success": False}, 403)


@major_project_bp.route('/major_project/review', methods=['POST'])
Expand Down
6 changes: 6 additions & 0 deletions conditional/templates/major_project_submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<div class="container main">
<h3 class="page-title">Major Project Form</h3>
{% if is_active %}
<form data-module="majorProjectForm">
<div class="panel panel-default">
<div class="panel-body">
Expand All @@ -27,6 +28,11 @@ <h3 class="page-title">Major Project Form</h3>
</div>
<input class="btn btn-raised btn-primary" style="width:100%;margin-bottom:20px;" type="submit" value="Submit Major Project">
</form>
{% else %}
<div class="alert alert-success" role="alert">
<span class="glyphicon glyphicon-ok-sign"></span> You are not required to complete a major project.
</div>
{% endif %}
<h3 class="page-title">All Major Projects</h3> {% if major_projects_len
<=0 %} <div class="panel panel-default">
<div class="panel-body">
Expand Down