Skip to content

Commit

Permalink
Merge pull request #13 from mechero/1_0_1
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
mechero authored Oct 25, 2018
2 parents 1779960 + 8c2a6e9 commit fbe2fdf
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 44 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
35 changes: 23 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
language: java
jdk:
- oraclejdk10
before_script:
cd sonar-connector
addons:
sonarcloud:
organization: "thepracticaldeveloper"
branches:
- master
- develop
- docker-compose-game
script:
- mvn clean install sonar:sonar
- openjdk10

stages:
- tests-sonar
- docker-build
- deploy

jobs:
include:
- stage: tests-sonar
addons:
sonarcloud:
organization: "thepracticaldeveloper"
before_script: cd sonar-connector
script:
- mvn clean install sonar:sonar
- stage: docker-build
sudo: required
services: docker
script: docker-compose -f docker-compose-build.yml build
- stage: deploy
script: echo "Deploying... (noop)"

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
}
}
8 changes: 8 additions & 0 deletions web-client/src/app/members/User.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
export class User {

constructor(id: string, login: string, alias: string, team: string) {
this.id = id;
this.login = login;
this.alias = alias;
this.team = team;
}

id: string;
login: string;
alias: string;
Expand Down
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
2 changes: 1 addition & 1 deletion web-client/src/app/settings/organizer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1 class="border-bottom">Players</h1>
<td *ngIf="user.id !== editingId"><span class="badge badge-pill badge-info badge-normal">{{user.team}}</span></td>
<td *ngIf="user.id === editingId">
<select id="team" [(ngModel)]="user.team">
<option value="--NO-TEAM--">--NO-TEAM--</option>
<option value="{{TEAM_NOT_ASSIGNED}}">{{TEAM_NOT_ASSIGNED}}</option>
<option *ngFor="let team of teams" [value]="team.name">{{team.name}}</option>
</select>
</td>
Expand Down
5 changes: 4 additions & 1 deletion web-client/src/app/settings/organizer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {User} from "../members/User";
})
export class OrganizerComponent implements OnInit {

readonly TEAM_NOT_ASSIGNED: string = '--NO-TEAM--';

constructor(private teamsService: TeamsService,
private usersService: MemberService) {
}
Expand Down Expand Up @@ -53,7 +55,8 @@ export class OrganizerComponent implements OnInit {
this.editingId = id;
}

async saveUser(user: User) {
async saveUser(_user: User) {
let user = new User(_user.id, _user.login, _user.alias, _user.team === this.TEAM_NOT_ASSIGNED ? null : _user.team);
let userPromise = this.usersService.updateUser(user);
await userPromise;
this.noEditing();
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 fbe2fdf

Please sign in to comment.