Skip to content
Snippets Groups Projects

Auto-shortlist the student proposer in case of project proposed by a student.

Merged Andrea Callia D'Iddio requested to merge auto-shortlist-student-proposal into master
All threads resolved!
+ 13
0
@@ -19,6 +19,17 @@ def shortlist_proposer(project):
db.session.commit()
def unshortlist_old_proposer(project: Project):
shortlisting: Shortlisting = (
Shortlisting.query.filter(Shortlisting.project_id == project.id)
.filter_by(student=project.on_behalf)
.first()
)
if shortlisting:
db.session.delete(shortlisting)
db.session.commit()
@bp.route("/projects")
@login_required
def projects():
@@ -66,6 +77,8 @@ def edit_project(project_id):
if project := Project.query.get(project_id):
form = ProjectForm()
on_behalf_changed = project.on_behalf != form.on_behalf.data
if on_behalf_changed and project.on_behalf:
unshortlist_old_proposer(project)
if form.validate_on_submit():
project.title = form.title.data
project.description = form.description.data
Loading