Correct internal error when guild is not set on rank page

This commit is contained in:
Sebastien 2019-01-02 00:26:00 +01:00
parent 4e9728cbd3
commit c1cc670906
2 changed files with 134 additions and 125 deletions

View File

@ -157,9 +157,14 @@ public class GeneralWebView {
model.addAttribute("redirect_url", System.getenv("OAUTH_URL"));
try {
UserEntity userEntity = userUtils.getUserWithApiToken(userRepository, token);
GuildStatsPack stack;
if(!cookieGuildId.equals("")){
stack = UserStatsUtils.getINSTANCE().getStatPack(userEntity, cookieGuildId);
addGuildAndRedirect(model, cookieGuildId);
GuildStatsPack stack = UserStatsUtils.getINSTANCE().getStatPack(userEntity, cookieGuildId);
}
else
stack = null;
model.addAttribute("stack", stack);
return CheckPage.getPageIfReady("rank");

View File

@ -46,6 +46,7 @@
<main>
<!--/*@thymesVar id="stack" type="net.Broken.Tools.UserManager.Stats.GuildStatsPack"*/-->
<th:block th:if="${stack != null}">
<div class="row">
<div class="card-panel col l6 offset-l3 m10 offset-m1 s10 offset-s1 grey darken-4 white-text">
<div class="row" style="margin-bottom: 0">
@ -88,7 +89,8 @@
<tr>
<td>
<h4 style="font-weight: bold; margin: 0"><span th:text="${stack.selfStats.total}"
th:remove="tag"></span> <span>Xp</span>
th:remove="tag"></span>
<span>Xp</span>
</h4>
</td>
</tr>
@ -133,7 +135,8 @@
<tbody>
<tr>
<td>
<h4 style="font-weight: bold; margin: 0"><span th:text="${stack.selfStats.messageCount}"
<h4 style="font-weight: bold; margin: 0"><span
th:text="${stack.selfStats.messageCount}"
th:remove="tag"></span> <span>msg</span>
</h4>
</td>
@ -167,7 +170,7 @@
<th:block th:each="stat : ${stack.ranking}">
<tr>
<td th:text="${stat.rank}"></td>
<td><img th:src="${stat.avatarUrl}" class="circle" style="max-height: 50px"/> </td>
<td><img th:src="${stat.avatarUrl}" class="circle" style="max-height: 50px"/></td>
<td th:text="${stat.userName}"></td>
<td> <span th:text="${T(net.Broken.Tools.TimeConvertor).sToTime(stat.voiceTime).get(0)}"
th:remove="tag"></span> <span>H</span>
@ -188,6 +191,7 @@
</div>
</th:block>
</main>