Commit 2775d508 authored by Saikiran Srirangapalli's avatar Saikiran Srirangapalli

Merge branch 'master' into pdf_upload

parents 2df9f93c e90d8270
import gradaudit.gradaudit as gradaudit
import gradaudit.util as util
from flask import Flask, render_template, request
from response import Response
app = Flask(__name__)
......@@ -22,13 +21,8 @@ def submit():
year = request.form['YearList']
spec = request.form['SpecializationOfDegree'].lower()
classes = request.form['classesTaken'].replace(' ','')
transcript = '{0}\n'\
'{1},{2},{3},{4}\n'\
'{5}\n'.format(name,
degree, major, year, spec,
classes)
student_data = gradaudit.parse_transcript(transcript)
transcript = util.Transcript(name, degree, major, year, spec, classes)
resp = Response(student_data)
resp = Response(transcript)
return render_template('GASTemplate.html', response=resp)
Subproject commit cf3a8e7274f4573bec383d2b4a308436ad86f488
Subproject commit 9affc399e8ea7a450300f8b5427e38c046f16780
import re
from tempfile import NamedTemporaryFile
import gradaudit.gradaudit as gradaudit
import gradaudit.util as util
from subprocess import check_output
class Response:
def __init__(self, student_data):
self.name = student_data[0]
self.degree = student_data[1]
self.major = student_data[2]
self.year = student_data[3]
self.spec = student_data[4]
self.classes_taken = student_data[5]
def __init__(self, transcript):
self.transcript = transcript
main_contents = util.gen_main(transcript)
main_contents = gradaudit.gen_main(*student_data)
with NamedTemporaryFile() as fil:
fil.write(main_contents)
fil.flush()
answer_set = check_output(['sasp',fil.name])
self.missing_classes = re.findall('hasNotTaken\({},([a-z]+[1-4][0-9V][0-9][0-9])\)'
.format(self.name),answer_set)
self.missing_hours = re.findall('needsHours\({},([a-zA-Z]+),([0-9]+)\)'.format(self.name),answer_set)
self.missing_electives = re.findall('needsElectiveHours\({},([0-9])\)'.format(self.name),answer_set)
self.can_grad = 'ableToGraduate({0})'.format(self.name) in answer_set
.format(transcript.name),answer_set)
self.missing_hours = re.findall('needsHours\({},([a-zA-Z]+),([0-9]+)\)'.format(transcript.name),answer_set)
self.missing_electives = re.findall('needsElectiveHours\({},([0-9])\)'.format(transcript.name),answer_set)
self.can_grad = 'ableToGraduate({0})'.format(transcript.name) in answer_set
if self.missing_electives == []:
self.missing_electives = 0
......
......@@ -3,9 +3,9 @@
<body>
<h1>Audit Result</h1>
{% if response.can_grad %}
<p>{{response.name}} is able to graduate with a degree in {{response.major}}.</p>
<p>{{response.transcript.name}} is able to graduate with a degree in {{response.transcript.major}}.</p>
{% else %}
<p>{{response.name}} is not able to graduate.<br>To graduate, {{response.name}} needs to take <br></p>
<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 %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment