...
 
Commits (4)
......@@ -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
......
......@@ -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', error_message=error_list)
This diff is collapsed.
This diff is collapsed.