If your are not top 10, your rank is now correctly displayed in top 10
This commit is contained in:
parent
986b7fbba2
commit
8868ce61fe
@ -21,11 +21,11 @@
|
|||||||
<q-tab-panels v-model="tab" animated swipeable class="col">
|
<q-tab-panels v-model="tab" animated swipeable class="col">
|
||||||
<q-tab-panel name="solo" class="q-pa-md fit">
|
<q-tab-panel name="solo" class="q-pa-md fit">
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-card class="q-mb-md" v-for="(user, index) in rankinglist" :key="user.id">
|
<q-card class="q-mb-md" v-for="(user) in rankinglist" :key="user.id">
|
||||||
<q-item class="q-pr-sm ">
|
<q-item class="q-pr-sm ">
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label v-if="username === user.username"><a class="text-green" style="text-decoration: none"><span>{{index+1}}. {{user.username}}</span></a></q-item-label>
|
<q-item-label v-if="username === user.username"><a class="text-green" style="text-decoration: none"><span>{{user.rank}}. {{user.username}}</span></a></q-item-label>
|
||||||
<q-item-label v-if="username !== user.username"><a class="text-black" style="text-decoration: none"><span>{{index+1}}. {{user.username}}</span></a></q-item-label>
|
<q-item-label v-if="username !== user.username"><a class="text-black" style="text-decoration: none"><span>{{user.rank}}. {{user.username}}</span></a></q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<span class="text-grey">{{user.rankingPointsSum}} Punkte </span>
|
<span class="text-grey">{{user.rankingPointsSum}} Punkte </span>
|
||||||
|
|||||||
@ -392,9 +392,11 @@ public class Controller {
|
|||||||
logger.debug("/api/getRankingList create sendBackUsers");
|
logger.debug("/api/getRankingList create sendBackUsers");
|
||||||
List<Object[]> rankingUsers = userRepository.getRankingList();
|
List<Object[]> rankingUsers = userRepository.getRankingList();
|
||||||
logger.debug("/api/getRankingList got Object[] from DB");
|
logger.debug("/api/getRankingList got Object[] from DB");
|
||||||
|
int rank = 1;
|
||||||
for (Object[] obj : rankingUsers) {
|
for (Object[] obj : rankingUsers) {
|
||||||
RankingListHelper tmp = new RankingListHelper((String) obj[1], (Integer) obj[2]);
|
RankingListHelper tmp = new RankingListHelper((String) obj[1], (Integer) obj[2], rank);
|
||||||
sendBackUsers.add(tmp);
|
sendBackUsers.add(tmp);
|
||||||
|
rank++;
|
||||||
}
|
}
|
||||||
logger.debug("/api/getRankingList Converted Objects to RankingListHelper");
|
logger.debug("/api/getRankingList Converted Objects to RankingListHelper");
|
||||||
logger.debug("/api/getRankingList RankingList: " + new GsonBuilder().setPrettyPrinting().create().toJson(sendBackUsers));
|
logger.debug("/api/getRankingList RankingList: " + new GsonBuilder().setPrettyPrinting().create().toJson(sendBackUsers));
|
||||||
@ -433,7 +435,7 @@ public class Controller {
|
|||||||
ResponseEntity singlePlace = getRankingPlace(user.getEmail());
|
ResponseEntity singlePlace = getRankingPlace(user.getEmail());
|
||||||
|
|
||||||
if (singlePlace.getStatusCodeValue() == 200) {
|
if (singlePlace.getStatusCodeValue() == 200) {
|
||||||
RankingListHelper rankingListHelper = new RankingListHelper(user.getUsername(), (Integer) user_infoRepository.findUser_InfoByUser(user).getRankingPointsSum());
|
RankingListHelper rankingListHelper = new RankingListHelper(user.getUsername(), (Integer) user_infoRepository.findUser_InfoByUser(user).getRankingPointsSum(), (Integer) getRankingPlace(user.getEmail()).getBody());
|
||||||
logger.debug(String.valueOf((Integer) singlePlace.getBody()));
|
logger.debug(String.valueOf((Integer) singlePlace.getBody()));
|
||||||
sendBackUsers.add(rankingListHelper);
|
sendBackUsers.add(rankingListHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,12 @@ public class RankingListHelper {
|
|||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
private int rankingPointsSum;
|
private int rankingPointsSum;
|
||||||
|
private int rank;
|
||||||
|
|
||||||
public RankingListHelper(String username, int ranking_Points) {
|
public RankingListHelper(String username, int ranking_Points, int rank) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.rankingPointsSum = ranking_Points;
|
this.rankingPointsSum = ranking_Points;
|
||||||
|
this.rank = rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
@ -26,6 +28,14 @@ public class RankingListHelper {
|
|||||||
this.rankingPointsSum = ranking_Points;
|
this.rankingPointsSum = ranking_Points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRank() {
|
||||||
|
return rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRank(int rank) {
|
||||||
|
this.rank = rank;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "( " + username + " | " + rankingPointsSum + " )";
|
return "( " + username + " | " + rankingPointsSum + " )";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user