fix: error when no creator

This commit is contained in:
Martin Eyben 2024-12-04 18:41:40 +00:00
parent f047aff693
commit 30e28ecd11
2 changed files with 41 additions and 28 deletions

View File

@ -13,40 +13,53 @@
<body>
<%- include('partials/header.ejs') %>
<main>
<h1>
Liste des modeles
</h1>
<main>
<h1>
Liste des modeles
</h1>
<div class="table">
<table>
<thead>
<table>
<thead>
<tr>
<th>Id modèle</th>
<th>Nom modèle</th>
<th>Proposé par</th>
<th>Avis</th>
<th></th>
</tr>
</thead>
<tbody>
<% models.forEach(function(model) { %>
<tr>
<th>Id modèle</th>
<th>Nom modèle</th>
<th>Proposé par</th>
<th>Avis</th>
<th></th>
</tr>
</thead>
<tbody>
<% models.forEach(function(model) { %>
<tr>
<td><%=model.id%></td>
<td><%=model.name%></td>
<td><a href="/membres/byid/<%=model.creator.id_member%>"><i class="fa-solid fa-user"></i> <%=model.creator.name%></a></td>
<td><%=model.review.first%>/5 (<%=model.review.second%> avis)</td>
<td><a href="/models/byname/<%=model.name%>"><i class="fa-solid fa-eye"></i></a></td>
<td>
<%=model.id%>
</td>
<td>
<%=model.name%>
</td>
<% if (model.creator===undefined) {%>
<td></td>
<% } else {%>
<td><a href="/membres/byid/<%=model.creator.id_member%>"><i class="fa-solid fa-user"></i>
<%=model.creator.name%>
</a></td>
<% } %>
<td>
<%=model.review.first%>/5 (<%=model.review.second%> avis)
</td>
<td><a href="/models/byname/<%=model.name%>"><i class="fa-solid fa-eye"></i></a></td>
</tr>
<% }); %>
<% }); %>
</tbody>
</table>
<div class="box"></div>
</div>
</tbody>
</table>
<div class="box"></div>
</div>
</main>
</main>
</body>

View File

@ -6,7 +6,7 @@ type Model = {
id: number;
name: string;
url: string;
creator: Member;
creator: Member | undefined;
inheritFrom: number;
pieces: Array<Pair<Piece, number>>
review: Pair<number, number>