WebHost: count non-owned Rooms of a given Seed

This commit is contained in:
Fabian Dill 2022-01-13 07:41:31 +01:00
parent 1990b893e5
commit 44cf8efc06
2 changed files with 6 additions and 3 deletions

View File

@ -136,8 +136,7 @@ def view_seed(seed: UUID):
seed = Seed.get(id=seed)
if not seed:
abort(404)
return render_template("viewSeed.html", seed=seed,
rooms=[room for room in seed.rooms if room.owner == session["_id"]])
return render_template("viewSeed.html", seed=seed)
@app.route('/new_room/<suuid:seed>')

View File

@ -31,12 +31,16 @@
<tr>
<td>Rooms:&nbsp;</td>
<td>
{% call macros.list_rooms(rooms) %}
{% call macros.list_rooms(seed.rooms | selectattr("owner", "eq", session["_id"])) %}
<li>
<a href="{{ url_for("new_room", seed=seed.id) }}">Create New Room</a>
</li>
{% endcall %}
{% if seed.rooms %}<span>
There are a total of {{ seed.rooms | length }} Rooms, only those created by you are linked above.
</span>{% endif %}
</td>
</tr>
</tbody>
</table>