Skip to content
Snippets Groups Projects
Commit 0a0f13df authored by Seb Barnard's avatar Seb Barnard :speech_balloon:
Browse files

Added a potential fix for no rewards error

parent 7d14f803
Branches
No related tags found
3 merge requests!114LoggingService service class, new method to add a log to the "Logs" table when...,!87added non-functional testing (see DeleteShopTests.java for notes) + added serverside validation,!86Issue thirty one
......@@ -21,11 +21,13 @@ public class ClaimableRewards {
public int nextReward(UserStampBoards u){
List<Rewards> r = u.getStampBoard().getRewards();
for(int i = 1; i<u.getStampBoard().getRewards().size()-1; i++){
if((r.get(i).getRewardStampLocation() >= u.getUserStampPosition()) &&
(r.get(i-1).getRewardStampLocation() <= u.getUserStampPosition())){
if (r.size() != 0) {
for (int i = 1; i < u.getStampBoard().getRewards().size() - 1; i++) {
if ((r.get(i).getRewardStampLocation() >= u.getUserStampPosition()) &&
(r.get(i - 1).getRewardStampLocation() <= u.getUserStampPosition())) {
return r.get(i).getRewardStampLocation();
return r.get(i).getRewardStampLocation();
}
}
}
return 0;
......
......@@ -17,6 +17,7 @@
<div class="reward_card_content">
<h1 class="title is-4 mb-1" th:text="${title}" style="white-space: break-spaces;"></h1>
<p class="mb-1" th:text="'You have ' + ${stamps} + ' stamps!'"></p>
<th:block th:if="${next_reward != 0}">
<progress class="progress mb-1" th:value="${stamps}" th:max="${next_reward}"></progress>
<p class="mb-2" th:text="${next_reward}-${stamps} + ' to next reward'"></p>
<div class="is-full-width" style="display:flex;justify-content: space-between;align-items: center">
......@@ -35,6 +36,27 @@
</button>
</div>
</div>
</th:block>
<th:block th:if="${next_reward == 0}">
<progress class="progress mb-1" th:value="${stamps}" th:max="${stamps}"></progress>
<p class="mb-2" th:text=""></p>
<div class="is-full-width" style="display:flex;justify-content: space-between;align-items: center">
<div class="level-left">
<span class="icon is-small is-left ml-1 mr-1">
<i class="fas fa-gift"></i>
</span>
<p text="No rewards!"></p>
</div>
<div class="level-right">
<button class="button is-rounded">
Explore
<span class="icon is-small is-left ml-1">
<i class="fas fa-arrow-right"></i>
</span>
</button>
</div>
</div>
</th:block>
</div>
<div class="reward_card_img" th:style="'background-image:url(' + ${img_path} + ');'"></div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment