...
 
Commits (12)
......@@ -47,7 +47,7 @@ class GASResponse(object):
self.transcript = transcript
main_contents = util.gen_main(transcript)
answer_set = GASResponse._run(main_contents)
answer_set = GASResponse._run(main_contents).decode("utf-8")
advice = GASResponse._extract_advice(answer_set, transcript.name)
self.missing_classes = advice[0]
......@@ -59,7 +59,7 @@ class GASResponse(object):
def _run(cls, main_contents):
""" Run the program under s(ASP) and return the answer set """
with NamedTemporaryFile() as fil:
fil.write(main_contents)
fil.write(main_contents.encode("utf-8"))
fil.flush()
# Command to run audit
......
......@@ -28,7 +28,7 @@ app = Flask(__name__)
@app.route('/', methods=['POST', 'GET'])
def input_form():
if request.method == 'GET':
return render_template('GASGUI.html')
return render_template('home.html')
uploaded = request.files['transcriptPDF']
with NamedTemporaryFile() as fil:
......@@ -38,31 +38,34 @@ def input_form():
courses = map(lambda x: x[0], course_data)
courses = ','.join(courses)
return render_template('GASGUI.html', classes=courses)
return render_template('home.html', classes=courses)
@app.route('/submit', methods=['POST'])
def submit():
name = 'student'
degree = request.form['degreeType']
major = request.form['MajorList']
year = request.form['YearList']
spec = request.form['SpecializationOfDegree'].lower()
classes = request.form['classesTaken']
degree = request.form['degree_type']
major = request.form['major']
year = request.form['year']
spec = request.form['specialization'].lower()
classes = request.form['classes']
classes = re.sub(r'\s+', '', classes)
classes = classes.rstrip(',')
classes = classes.split(',')
if classes == ['']:
classes = []
transcript = util.Transcript(
name, degree, major, year, spec, classes)
resp = GASResponse(transcript)
return render_template('GASTemplate.html', response=resp)
return render_template('results.html', response=resp)
@app.errorhandler(500)
def exc(err):
error_list = str(err).split("\n")
return render_template('GASErrorTemplate.html', error_message=error_list)
return render_template('error.html', error_message=error_list)
Subproject commit 640a2fca9b2d20bb738a01c88ca5d29a5996176e
Subproject commit 21b3bcbc8d01a1adc62e155e139512023c37fb5c
html,body {
margin:0;
padding:0;
background-color: #778899;
.margin-small{
margin: 5%;
}
.site{
text-align: center;
background-color: #778899;
color:white;
.margin-tiny{
margin: 2.5%
}
.upload,.student_info,.result {
border-style:solid;
border-color:black;
display:inline-block;
width:auto;
padding:20px;
margin:20px;
background-color:#586674;
}
.error {
border-style:solid;
border-color:black;
background-color:#586674;
color:white;
}
.important{
font-weight: bold;
}
.upload_field {
margin:10px;
}
button,input,select,textarea {
background:#b6bfc8;
color:black;
margin:6px
}
a,a.visited {
color:white;
}
function addClass() {
var newClass = document.getElementById("classes").value;
var classes = document.getElementById("classesTaken").value;
var newClass = document.getElementById("class").value;
var classes = document.getElementById("classes").value;
classes = classes.concat(newClass);
document.getElementById("classesTaken").value = classes + ",";
document.getElementById("classes").value = classes + ",";
}
function degreeSelectHandler(degree) {
var yearList = document.getElementById('YearList');
var specializationList = document.getElementById('SpecializationOfDegree');
var yearList = document.getElementById('year');
var specializationList = document.getElementById('specialization');
removeOptions(yearList);
removeOptions(specializationList);
......@@ -64,8 +64,8 @@ function goBack() {
}
function fillOutExample() {
document.getElementById("MajorList").value = "math";
document.getElementById("SpecializationOfDegree").value = "applied";
document.getElementById("YearList").value = "2015"
document.getElementById("classesTaken").value = "cs1337,phys2125,phys2126,phys2325,phys2326,chem1311,chem1111,math2417,hist1301,hist1302,math2419,govt2305,govt2306,rhet1302,cs2305,cs2336,cs3305,cs3340,math2418,ahst2331,math3310,cs3345,cs3341,cs4V98,math2451,math3311,math3323,ecs1200,ecs3390"
document.getElementById("major").value = "math";
document.getElementById("specialization").value = "applied";
document.getElementById("year").value = "2015"
document.getElementById("classes").value = "cs1337,phys2125,phys2126,phys2325,phys2326,chem1311,chem1111,math2417,hist1301,hist1302,math2419,govt2305,govt2306,rhet1302,cs2305,cs2336,cs3305,cs3340,math2418,ahst2331,math3310,cs3345,cs3341,cs4V98,math2451,math3311,math3323,ecs1200,ecs3390"
};
<!DOCTYPE html>
<html>
<body>
<script src="{{ url_for('static', filename='GAS.js') }}"></script>
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='GAS.css') }}">
<div class="error">
<h1>An error has occured during your audit!</h1>
<p>
{% for line in error_message %}
{{line}}<br>
{% endfor %}
</p>
</div>
<button type="button" onclick="goBack()">Click here to go back</button>
</body>
</html>
This diff is collapsed.
<!DOCTYPE html>
<html>
<body>
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='GAS.css') }}">
<div class="site">
<script src="{{ url_for('static', filename='GAS.js') }}"></script>
<div class="result">
<h1>Audit Result</h1>
{% if response.can_grad %}
<p>{{response.transcript.name}} is able to graduate with a degree in {{response.transcript.major}}.</p>
{% else %}
<p>{{response.transcript.name}} is not able to graduate.<br>To graduate, {{response.transcript.name}} needs to take <br></p>
<ul>
{% for class in response.missing_classes %}
<li>{{class}}</li>
{% endfor %}
{# ex: need 6 hours of americanHistory requirement #}
{% for type,number in response.missing_hours %}
<li>{{number}} hours of {{type}}</li>
{# 6 hours of americanHistory #}
{% endfor %}
{% if response.missing_electives != 0 %}
<li>{{response.missing_electives}} hours of elective credits</li>
{% endif %}
</ul>
{% endif %}
<button onclick="goBack()">Click here to go back</button>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title> Graduation Audit System </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href={{ url_for('static', filename='GAS.css') }}>
<link rel="shortcut icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<link rel="icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<script src={{ url_for('static', filename='GAS.js') }}></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<h1>An error has occured during your audit!</h1>
<p>
{% for line in error_message %}
{{line}}<br>
{% endfor %}
</p>
<button type="button" onclick="goBack()">Click here to go back</button>
</body>
</html>
{% from 'macros.html' import course_list %}
<!DOCTYPE html>
<html>
<head>
<title> Graduation Audit System </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href={{ url_for('static', filename='GAS.css') }}>
<link rel="shortcut icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<link rel="icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<script src={{ url_for('static', filename='GAS.js') }}></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="jumbotron text-center">
<h1> Graduation Audit System </h1>
<p>
An automated degree audit system for various degree plans at The University of Texas at Dallas
</p>
</div>
<div class="alert alert-warning margin-small">
<strong>Warning!</strong> This is an experimental software prototype system and the results are only advisory. For an official degree audit you should visit with your UT Dallas undergraduate advisor.
</div>
<ul class="nav nav-pills margin-tiny">
<li class="active"><a data-toggle="tab" href="#manual">Manual</a></li>
<li><a data-toggle="tab" href="#upload">Upload Your Transcript</a></li>
</ul>
<div class="tab-content">
<div id="manual" class="tab-pane fade margin-tiny active in">
<form action={{ url_for('submit') }} method="post">
<div class="form-group">
<label>Degree Type</label>
<input type="radio" name="degree_type" value="bs" checked=true/>BS
<input type="radio" name="degree_type" value="ba" disabled=true/> BA
</div>
<div class="form-group">
<label for="major">Major</label>
<select name="major" onchange="degreeSelectHandler(this)" id="major" required>
<option value="">Please Select Your Major</option>
<option value="cs">Computer Science</option>
<option value="math">Mathematics</option>
<option value="me">Mechanical Engineering</option>
<option value="se">Software Engineering</option>
</select>
</div>
<div class="form-group">
<label for="year">Year of Degree Plan</label>
<select name="year" id="year">
<option value="2014">2014</option>
<option value="2015">2015</option>
</select>
</div>
<div class="form-group">
<label for="specialization">Specialization/Domain:</label>
<select name="specialization" id="specialization">
<option value="none">None</option>
<option value="applied">Mathematics-Applied</option>
<option value="mathematics">Mathematics-Mathematics</option>
<option value="statistics">Mathematics-Statistics</option>
<option value="AICog">Software Engineering-Artificial Intelligence and Cognitive Modeling</option>
<option value="compImaging">Software Engineering-Computer Imaging</option>
<option value="embedded">Software Engineering-Embedded Systems</option>
<option value="infoAssurance">Software Engineering-Information Assurance</option>
<option value="HumanCompInteraction">Software Engineering-Human-Computer Interaction</option>
<option value="networks">Software Engineering-Networks</option>
</select>
</div>
<div class="form-group">
<label for="classes">Type in your class number (ex: cs1336), and hit the "Add Class" button to enter it.</label>
<input list="classes-datalist" type="text" name="class" id="class" >
{{ course_list() }}
<button type="button" onclick="addClass()">Add class</button>
</div>
<div class="form-group">
<label for="classes">Classes Taken</label><br>
<textarea name="classes" id="classes" rows="6" cols="60"></textarea>
<div class="button">
<button type="button" onclick="fillOutExample()">Fill out Example</button>
</div>
<div class="button">
<input type="submit" value="Perform Audit"></input>
</div>
</div>
</form>
</div>
<div id="upload" class="tab-pane fade margin-tiny">
<form action={{ url_for('input_form') }} method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="transcriptPDF" class="upload_field">Upload an unofficial transcript from Galaxy.</label>
<input name="transcriptPDF" type="file" accept="application/pdf" class="upload_field">
<input type="submit" class="upload_field" value="Click here to fill out the forms automatically.">
</div>
</form>
</div>
</div>
</body>
</html>
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<title> Graduation Audit System </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href={{ url_for('static', filename='GAS.css') }}>
<link rel="shortcut icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<link rel="icon" href={{ url_for('static', filename='favicon.ico') }} type="image/x-icon">
<script src={{ url_for('static', filename='GAS.js') }}></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="result">
<h1>Audit Result</h1>
{% if response.can_grad %}
<p>{{response.transcript.name}} is able to graduate with a degree in {{response.transcript.major}}.</p>
{% else %}
<p>{{response.transcript.name}} is not able to graduate.<br>To graduate, {{response.transcript.name}} needs to take <br></p>
<ul>
{% for class in response.missing_classes %}
<li>{{class}}</li>
{% endfor %}
{# ex: need 6 hours of americanHistory requirement #}
{% for type,number in response.missing_hours %}
<li>{{number}} hours of {{type}}</li>
{# 6 hours of americanHistory #}
{% endfor %}
{% if response.missing_electives != 0 %}
<li>{{response.missing_electives}} hours of elective credits</li>
{% endif %}
</ul>
{% endif %}
<button onclick="goBack()">Click here to go back</button>
</div>
</body>
</html>