Skip to content

Commit

Permalink
A few improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mechero committed Oct 21, 2018
1 parent e88caab commit 8c2a6e9
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BACKEND_VERSION=1.0
UI_VERSION=1.0
BACKEND_VERSION=1.0.1
UI_VERSION=1.0.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.thepracticaldeveloper.devgame.modules.retriever.controller;

import com.thepracticaldeveloper.devgame.modules.retriever.service.SonarDataRetriever;
import com.thepracticaldeveloper.devgame.modules.users.dto.MessageResponseDTO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -17,8 +18,8 @@ public RetrieverController(final SonarDataRetriever retriever) {
}

@PostMapping("/now")
public ResponseEntity<String> retrieveNow() {
public ResponseEntity<MessageResponseDTO> retrieveNow() {
sonarDataRetriever.retrieveData();
return ResponseEntity.ok().body("requested");
return ResponseEntity.ok().body(new MessageResponseDTO("Requested"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public List<SonarStatsRow> getSortedStatsPerUser() {
return users.map(user -> {
final SonarStatsRow statsRow = new SonarStatsRow(user.getAlias(), user.getTeam());
scoreCardMongoRepository.findAllByUserId(user.getId()).forEach(scoreCard -> {
statsRow.addTotalPoints(scoreCard.getScore());
// The total score is proportional to the severity
statsRow.addTotalPoints(scoreCard.getScore() * scoreCard.getSeverityType().getScore());
statsRow.addPaidDebt(scoreCard.getPaidDebtMinutes());
addSeverityTypeCounter(statsRow, scoreCard.getSeverityType());
});
Expand Down
11 changes: 9 additions & 2 deletions web-client/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@
<a class="nav-link" href="https://quboo.tpd.io">Help</a>
</li>
<li class="nav-item navbar-item-custom">
<a class="nav-link" (click)="forceRetrieval()"><fa name="refresh"></fa></a>
<a class="nav-link" (click)="forceRetrieval()">
<fa name="refresh" style="cursor: pointer"></fa>
</a>
</li>
</ul>
<div class="my-2 my-lg-0 ptr" *ngIf="code.name === '-NOCODE-'">
<div><a href="https://www.patreon.com/quboo"><img src="assets/img/become_a_patron_button.png"/></a></div>
<div>
<a href="https://www.patreon.com/quboo">
<img src="assets/img/become_a_patron_button.png"
alt="Become a Patreon" style="border: 2px solid white"/>
</a>
</div>
</div>
</nav>
<div class="gameBackgroundPanel">
Expand Down
4 changes: 1 addition & 3 deletions web-client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export class AppComponent implements OnInit {
}

forceRetrieval() {
this.retrieverService.forceRetrieval().then(
msg => console.log(msg)
);
this.retrieverService.forceRetrieval().then(); // does nothing, just wait for the UI to be refreshed automatically
}
}
28 changes: 19 additions & 9 deletions web-client/src/app/members/members.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@ <h3 class="text-center">Player Ranking</h3>
<table class="table table-striped table-dark" id="players">
<thead>
<tr>
<th>Ranking</th>
<th>Name</th>
<th>Team</th>
<th>Score</th>
<th>Badges</th>
<th style="width: 8%">Ranking</th>
<th style="width: 15%">Name</th>
<th style="width: 15%">Team</th>
<th style="width: 12%; text-align: right">Score</th>
<th style="width: 30%">Badges</th>
<th style="width: 4%"><fa name="ban"></fa></th>
<th style="width: 4%"><fa name="exclamation-circle"></fa> </th>
<th style="width: 4%"><fa name="arrow-circle-up"></fa></th>
<th style="width: 4%"><fa name="arrow-circle-down"></fa></th>
<th style="width: 4%"><fa name="info-circle"></fa></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let member of memberStats; let i = index" [ngClass]="{'text-primary': i===0}">
<td *ngIf="i === 0"><fa name="trophy" size="2x"></fa></td>
<td *ngIf="i > 0">{{i + 1}}</td>
<td *ngIf="i === 0" align="center"><img src="/assets/img/quboo_gold.png" alt="Golden Quboo" width="40px"/></td>
<td *ngIf="i > 0" align="center">{{i + 1}}</td>
<td>{{member.userAlias}}</td>
<td>{{member.userTeam}}</td>
<td>{{member.totalPoints}}</td>
<td><span *ngFor="let b of member.badges" class="badge badge-info">{{b.name}}</span></td>
<td align="right">{{member.totalPoints}}</td>
<td><span *ngFor="let b of member.badges" class="badge badge-success">{{b.name}}</span></td>
<td><span class="badge-stats">{{member.blocker}}</span></td>
<td><span class="badge-stats">{{member.critical}}</span></td>
<td><span class="badge-stats">{{member.major}}</span></td>
<td><span class="badge-stats">{{member.minor}}</span></td>
<td><span class="badge-stats">{{member.info}}</span></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions web-client/src/app/members/members.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {StatsRow} from '../common/StatsRow';
})
export class MembersComponent implements OnInit {
ngOnInit(): void {
setInterval(() => this.getMembers(), 20 * 1000);
this.getMembers();
}

Expand All @@ -25,6 +26,7 @@ export class MembersComponent implements OnInit {
}

getMembers(): void {
console.log('get members');
this.memberService.getMemberStats().then(memberStats => this.memberStats = memberStats);
}

Expand Down
3 changes: 1 addition & 2 deletions web-client/src/app/retriever/retriever.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ export class RetrieverService {
}

forceRetrieval(): Promise<String> {
return this.http.post(this.forceRetrievalUrl, null)
return this.http.post(this.forceRetrievalUrl, {})
.toPromise()
.catch(this.handleError);
}

private handleError(error: any): Promise<any> {
console.error('An error occurred accessing ' + this.forceRetrievalUrl, error);
if (error instanceof HttpErrorResponse) {
console.error("Response status: " + error.status + " | Message: " + error.message);
}
Expand Down
16 changes: 8 additions & 8 deletions web-client/src/app/teams/teams.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ <h3 class="text-center">Team Ranking</h3>
<table class="table table-striped table-dark" id="teams">
<thead>
<tr>
<th>Ranking</th>
<th>Team</th>
<th>Total Score</th>
<th>Total Paid Debt (min)</th>
<th style="width: 8%">Ranking</th>
<th style="width: 42%">Team</th>
<th style="width: 25%; text-align: right">Total Score</th>
<th style="width: 25%; text-align: center">Total Paid Debt (min)</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let team of teams; let i = index"
[ngClass]="{'text-primary': i===0}">
<td *ngIf="i === 0"><fa name="trophy" size="2x"></fa></td>
<td *ngIf="i > 0">{{i + 1}}</td>
<td *ngIf="i === 0" align="center"><img src="/assets/img/quboo_gold.png" alt="Golden Quboo" width="40px"/></td>
<td *ngIf="i > 0" align="center">{{i + 1}}</td>
<td>{{team.userTeam}}</td>
<td>{{team.totalPoints}}</td>
<td>{{team.totalPaidDebt}}</td>
<td style="text-align: right">{{team.totalPoints}}</td>
<td style="text-align: center">{{team.totalPaidDebt}}</td>
</tr>
</tbody>
</table>
Expand Down
5 changes: 5 additions & 0 deletions web-client/src/app/teams/teams.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export class TeamsComponent implements OnInit {
teams: StatsRow[];

ngOnInit(): void {
setInterval(() => this.getTeams(), 20 * 1000);
this.getTeams();
}

getTeams(): void {
this.teamsService.getTeamStats().then(teams => this.teams = teams);
}

Expand Down
Binary file added web-client/src/assets/img/quboo_gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion web-client/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body {
}
.footer-content {
display: flex;
align-items: center;
align-items: baseline;
justify-content: center;
}
.container-fluid {
Expand Down Expand Up @@ -77,11 +77,18 @@ body {
.badge-normal {
font-size: 100%;
}
.badge-stats {
font-size: 75%;
font-weight: lighter;
margin-right: 5px;
}
#players td {
font-size: 18px;
vertical-align: middle;
}
#teams td {
font-size: 18px;
vertical-align: middle;
}
.navbar-item-custom {
font-size: 18px;
Expand Down

0 comments on commit 8c2a6e9

Please sign in to comment.