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> <body>
<%- include('partials/header.ejs') %> <%- include('partials/header.ejs') %>
<main> <main>
<h1> <h1>
Liste des modeles Liste des modeles
</h1> </h1>
<div class="table"> <div class="table">
<table> <table>
<thead> <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> <tr>
<th>Id modèle</th> <td>
<th>Nom modèle</th> <%=model.id%>
<th>Proposé par</th> </td>
<th>Avis</th> <td>
<th></th> <%=model.name%>
</tr> </td>
</thead> <% if (model.creator===undefined) {%>
<tbody>
<% models.forEach(function(model) { %> <td></td>
<tr> <% } else {%>
<td><%=model.id%></td> <td><a href="/membres/byid/<%=model.creator.id_member%>"><i class="fa-solid fa-user"></i>
<td><%=model.name%></td> <%=model.creator.name%>
<td><a href="/membres/byid/<%=model.creator.id_member%>"><i class="fa-solid fa-user"></i> <%=model.creator.name%></a></td> </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.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> </tr>
<% }); %> <% }); %>
</tbody> </tbody>
</table> </table>
<div class="box"></div> <div class="box"></div>
</div> </div>
</main> </main>
</body> </body>

View File

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