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")); model.addAttribute("redirect_url", System.getenv("OAUTH_URL"));
try { try {
UserEntity userEntity = userUtils.getUserWithApiToken(userRepository, token); UserEntity userEntity = userUtils.getUserWithApiToken(userRepository, token);
GuildStatsPack stack;
if(!cookieGuildId.equals("")){
stack = UserStatsUtils.getINSTANCE().getStatPack(userEntity, cookieGuildId);
addGuildAndRedirect(model, cookieGuildId); addGuildAndRedirect(model, cookieGuildId);
GuildStatsPack stack = UserStatsUtils.getINSTANCE().getStatPack(userEntity, cookieGuildId); }
else
stack = null;
model.addAttribute("stack", stack); model.addAttribute("stack", stack);
return CheckPage.getPageIfReady("rank"); return CheckPage.getPageIfReady("rank");

View File

@ -46,6 +46,7 @@
<main> <main>
<!--/*@thymesVar id="stack" type="net.Broken.Tools.UserManager.Stats.GuildStatsPack"*/--> <!--/*@thymesVar id="stack" type="net.Broken.Tools.UserManager.Stats.GuildStatsPack"*/-->
<th:block th:if="${stack != null}">
<div class="row"> <div class="row">
<div class="card-panel col l6 offset-l3 m10 offset-m1 s10 offset-s1 grey darken-4 white-text"> <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"> <div class="row" style="margin-bottom: 0">
@ -88,7 +89,8 @@
<tr> <tr>
<td> <td>
<h4 style="font-weight: bold; margin: 0"><span th:text="${stack.selfStats.total}" <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> </h4>
</td> </td>
</tr> </tr>
@ -133,7 +135,8 @@
<tbody> <tbody>
<tr> <tr>
<td> <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> th:remove="tag"></span> <span>msg</span>
</h4> </h4>
</td> </td>
@ -188,6 +191,7 @@
</div> </div>
</th:block>
</main> </main>