Skip to content

Commit

Permalink
admin page that lists solver descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ceari committed Apr 12, 2012
1 parent c8ec8b6 commit d1cbb83
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
28 changes: 28 additions & 0 deletions edacc/templates/accounts/list_solver_descriptions.html
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block title %}List of submitted descriptions{% endblock %}
{% block content %}
<h2>List of submitted descriptions</h2>
<h3>By Solver</h3>
<ul>
{% for s in solvers %}
{% if s.description_pdf %}
<li><a href="{{ url_for('frontend.solver_description_download', database=database, solver_id=s.idSolver) }}">{{ s.name }}</a> (<a href="mailto:{{ s.user.email }}">{{ s.user.lastname}}, {{ s.user.firstname }}</a>)</li>
{% else %}
<li><span style="color: red">{{ s.name }} (missing)</span> (<a href="mailto:{{ s.user.email }}">{{ s.user.lastname}}, {{ s.user.firstname }}</a>)</li>
{% endif %}
{% endfor %}
</ul>
<h3>By category</h3>
{% for c in solvers_by_category %}
<p>{{ c.name }}</p>
<ul>
{% for s in solvers %}
{% if s.description_pdf %}
<li><a href="{{ url_for('frontend.solver_description_download', database=database, solver_id=s.idSolver) }}">{{ s.name }}</a> (<a href="mailto:{{ s.user.email }}">{{ s.user.lastname}}, {{ s.user.firstname }}</a>)</li>
{% else %}
<li><span style="color: red">{{ s.name }} (missing)</span> (<a href="mailto:{{ s.user.email }}">{{ s.user.lastname}}, {{ s.user.firstname }}</a>)</li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
{% endblock %}
2 changes: 2 additions & 0 deletions edacc/templates/accounts/list_users.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ <h2>Users</h2>
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}
<h2>Information</h2>
<a href="{{ url_for('accounts.list_solver_descriptions', database=database) }}">List of submitted descriptions</a>
<h2>Email addresses (Admins <strong>excluded</strong>)</h2> <h2>Email addresses (Admins <strong>excluded</strong>)</h2>
<a href="mailto:?bcc={% for u in users %}{% if not u.admin %}{{ u.email }};{% endif %}{% endfor %}">{% for u in users %}{% if not u.admin %}{{ u.email }}, {% endif %}{% endfor %}</a> <a href="mailto:?bcc={% for u in users %}{% if not u.admin %}{{ u.email }};{% endif %}{% endfor %}">{% for u in users %}{% if not u.admin %}{{ u.email }}, {% endif %}{% endfor %}</a>
<h2>Email addresses (Admins <strong>included</strong>)</h2> <h2>Email addresses (Admins <strong>included</strong>)</h2>
Expand Down
17 changes: 17 additions & 0 deletions edacc/views/accounts.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -550,6 +550,23 @@ def submit_solver(database, id=None):
return render('/accounts/submit_solver.html', database=database, error=error, return render('/accounts/submit_solver.html', database=database, error=error,
db=db, id=id, form=form) db=db, id=id, form=form)



@accounts.route('/<database>/list-solver-descriptions/', methods=['GET'])
@require_login
@require_admin
def list_solver_descriptions(database):
db = models.get_database(database) or abort(404)

solvers = [s for s in db.session.query(db.Solver).all() if s.User_idUser]

solvers_by_category = dict()
for category in db.session.query(db.CompetitionCategory).all():
solvers_by_category[category] = [s for s in category.solvers if s.User_idUser]

return render('/accounts/list_solver_descriptions.html', database=database,
db=db, solvers=solvers, solvers_by_category=solvers_by_category)


@accounts.route('/<database>/delete-solver/<int:solver_id>', methods=['GET']) @accounts.route('/<database>/delete-solver/<int:solver_id>', methods=['GET'])
@require_login @require_login
@require_phase(phases=(2, 4)) @require_phase(phases=(2, 4))
Expand Down

0 comments on commit d1cbb83

Please sign in to comment.