Rankinglist now highlights your name
This commit is contained in:
parent
81a4d7303c
commit
986b7fbba2
@ -21,11 +21,12 @@
|
|||||||
<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, index) 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><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-green" style="text-decoration: none"><span>{{index+1}}. {{user.username}}</span></a></q-item-label>
|
||||||
</q-item-section>
|
<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-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>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@ -69,7 +70,8 @@
|
|||||||
return {
|
return {
|
||||||
tab: 'solo',
|
tab: 'solo',
|
||||||
rankinglist: [],
|
rankinglist: [],
|
||||||
teamRankinglist: []
|
teamRankinglist: [],
|
||||||
|
username: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function() {
|
created: function() {
|
||||||
@ -77,16 +79,29 @@
|
|||||||
console.log("created(): " + this.teamRankinglist);
|
console.log("created(): " + this.teamRankinglist);
|
||||||
this.fetchRankinglist();
|
this.fetchRankinglist();
|
||||||
this.fetchTeamRankinglist();
|
this.fetchTeamRankinglist();
|
||||||
|
this.username = JSON.parse(localStorage.getItem('userToken')).name;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchRankinglist() {
|
fetchRankinglist() {
|
||||||
this.$axios.get('/api/getRankingList')
|
let token;
|
||||||
.then((response) => {
|
if(localStorage.getItem('userToken')){
|
||||||
console.log("Rankinglist: ");
|
token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||||
console.log(response.data);
|
this.$axios.get('/api/getRankingList', {params: {token}})
|
||||||
this.rankinglist = response.data;
|
.then((response) => {
|
||||||
}).catch((error) => {
|
console.log("Rankinglist: ");
|
||||||
})
|
console.log(response.data);
|
||||||
|
this.rankinglist = response.data;
|
||||||
|
}).catch((error) => {
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$axios.get('/api/getRankingList')
|
||||||
|
.then((response) => {
|
||||||
|
console.log("Rankinglist: ");
|
||||||
|
console.log(response.data);
|
||||||
|
this.rankinglist = response.data;
|
||||||
|
}).catch((error) => {
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fetchTeamRankinglist() {
|
fetchTeamRankinglist() {
|
||||||
this.$axios.get('/api/getTeamRankingList')
|
this.$axios.get('/api/getTeamRankingList')
|
||||||
|
|||||||
@ -419,11 +419,24 @@ public class Controller {
|
|||||||
|
|
||||||
User user = (User) getUser.getBody();
|
User user = (User) getUser.getBody();
|
||||||
|
|
||||||
ResponseEntity singlePlace = getRankingPlace(user.getEmail());
|
boolean userAlreadyInRankingList = false;
|
||||||
|
for (RankingListHelper rankingListHelper: sendBackUsers) {
|
||||||
|
logger.debug("RankingList Helper " + rankingListHelper.getUsername());
|
||||||
|
logger.debug("User: " + user.getUsername());
|
||||||
|
if(rankingListHelper.getUsername().equals(user.getUsername())){
|
||||||
|
userAlreadyInRankingList = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(singlePlace.getStatusCodeValue() == 200){
|
if(!userAlreadyInRankingList) {
|
||||||
RankingListHelper rankingListHelper = new RankingListHelper(user.getEmail(), (Integer) singlePlace.getBody());
|
ResponseEntity singlePlace = getRankingPlace(user.getEmail());
|
||||||
sendBackUsers.add(rankingListHelper);
|
|
||||||
|
if (singlePlace.getStatusCodeValue() == 200) {
|
||||||
|
RankingListHelper rankingListHelper = new RankingListHelper(user.getUsername(), (Integer) user_infoRepository.findUser_InfoByUser(user).getRankingPointsSum());
|
||||||
|
logger.debug(String.valueOf((Integer) singlePlace.getBody()));
|
||||||
|
sendBackUsers.add(rankingListHelper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(sendBackUsers));
|
return ResponseEntity.status(200).body(new Gson().toJson(sendBackUsers));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user