Skip to content
Snippets Groups Projects
Commit 8feb1631 authored by Andrea Callia D'Iddio's avatar Andrea Callia D'Iddio
Browse files

Merge branch 'show-full-names-in-rankings' into 'master'

Feat: Changes for showing full names in the ranking of projects, instead of...

See merge request !10
parents 5317035d 775ba635
No related branches found
No related tags found
1 merge request!10Feat: Changes for showing full names in the ranking of projects, instead of...
Pipeline #319411 passed
......@@ -15,7 +15,7 @@
<i class="fa-solid fa-bars"></i>&ensp;
</span>
<span>
{{ shortlisting.project.title }} - {{ shortlisting.student }}
{{ shortlisting.project.title }} - {{ full_names[shortlisting.id] }}
</span>
</li>
{% endfor %}
......
......@@ -15,7 +15,7 @@
<i class="fa-solid fa-bars"></i>&ensp;
</span>
<span>
{{ project.title }}
{{ project.title }} - {{ full_names[project.id] }}
</span>
</li>
{% endfor %}
......
......@@ -124,7 +124,23 @@ def projects_ranking():
.order_by(Shortlisting.staff_ranking)
.all()
)
return render_template("pages/staff/shortlisted-projects.html", projects=projects)
full_names = {}
for shortlisting in projects:
person = Person.query.filter(
Person.username == shortlisting.student
).first() or Person(username=shortlisting.student, firstname="", lastname="")
full_names[shortlisting.id] = (
person.full_name if person.full_name else person.username
)
return render_template(
"pages/staff/shortlisted-projects.html",
projects=projects,
full_names=full_names,
)
@bp.route("/projects/rankings", methods=["PUT"])
......
......@@ -42,8 +42,28 @@ def projects_ranking():
.order_by(Shortlisting.ranking)
.all()
)
full_names = {}
for shortlisting in shortlisted_projects:
username = (
shortlisting.proposer
if shortlisting.on_behalf is None
else shortlisting.on_behalf
)
person = Person.query.filter(Person.username == username).first() or Person(
username=username, firstname="", lastname=""
)
full_names[shortlisting.id] = (
person.full_name if person.full_name else person.username
)
return render_template(
"pages/student/shortlisted-projects.html", projects=shortlisted_projects
"pages/student/shortlisted-projects.html",
projects=shortlisted_projects,
full_names=full_names,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment