Skip to content

Commit

Permalink
Fixed a bug where the submit proposal button would readd the faculty,…
Browse files Browse the repository at this point in the history
… effectively doubling each fac entry on the course.
  • Loading branch information
hoerstl committed Jul 17, 2023
1 parent dcf435d commit 177e080
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
35 changes: 17 additions & 18 deletions app/controllers/serviceLearning/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def slcCreateCourse():
def slcSaveContinue():
"""Will update the the course proposal and return an empty string since ajax request needs a response
Also, it updates the course status as 'in progress'"""
print(request.data, "skadowwww")
course = updateCourse(request.form.copy(), attachments=getFilesFromRequest(request))

if not course:
Expand All @@ -108,23 +107,23 @@ def slcSaveContinue():
return redirect('/serviceLearning/courseManagement')
return redirect(f'/serviceLearning/editProposal/{request.form["courseID"]}?tab=2')

# @serviceLearning_bp.route('/serviceLearning/newProposal', methods=['GET', 'POST'])
# def slcCreateOrEdit():
# if request.method == "POST":
# course = updateCourse(request.form.copy())
# if not course:
# flash("Error saving changes", "danger")
# else:
# if getRedirectTarget(False):
# return redirect('' + getRedirectTarget(True) + '')
# return redirect('/serviceLearning/courseManagement')

# terms = Term.select().where(Term.year >= g.current_term.year)
# courseData = None
# return render_template('serviceLearning/slcNewProposal.html',
# terms = terms,
# courseData = courseData,
# redirectTarget = getRedirectTarget(True))
@serviceLearning_bp.route('/serviceLearning/newProposal', methods=['GET', 'POST'])
def slcCreateOrEdit():
if request.method == "POST":
course = updateCourse(request.form.copy())
if not course:
flash("Error saving changes", "danger")
else:
if getRedirectTarget(False):
return redirect('' + getRedirectTarget(True) + '')
return redirect('/serviceLearning/courseManagement')

terms = Term.select().where(Term.year >= g.current_term.year)
courseData = None
return render_template('serviceLearning/slcNewProposal.html',
terms = terms,
courseData = courseData,
redirectTarget = getRedirectTarget(True))

@serviceLearning_bp.route('/serviceLearning/approveCourse', methods=['POST'])
def approveCourse():
Expand Down
7 changes: 0 additions & 7 deletions app/static/js/slcNewProposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ function displayCorrectTab(navigateTab) {

if (currentTab >= allTabs.length) {
$("#nextButton").prop("disabled", true)
addInstructorsToForm()
$("#slcNewProposal").submit();
return false;
}
Expand Down Expand Up @@ -301,12 +300,6 @@ function validateForm() {
// Instructor manipulation functions
// -------------------------------------
//
function addInstructorsToForm() {
var form = $("#slcNewProposal");
$.each(getCourseInstructors(), function(idx,username) {
form.append($("<input type='hidden' name='instructor[]' value='" + username + "'>"));
});
}

function getRowUsername(element) {
return $(element).closest("tr").data("username")
Expand Down

0 comments on commit 177e080

Please sign in to comment.