From 0efd4a8b4dee05320124c2ee5258806009d952f3 Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Thu, 24 May 2018 18:03:59 -0300 Subject: [PATCH 01/10] first commit --- src/main/webapp/app/app.module.ts | 4 +++- .../leaderboard-component.component.html | 8 ++++++++ .../leaderboard-component.component.ts | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/main/webapp/app/leaderboard-component/leaderboard-component.component.html create mode 100644 src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index b0b65d9..3053c64 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -24,6 +24,7 @@ import { PageRibbonComponent, ErrorComponent } from './layouts'; +import { LeaderboardComponentComponent } from './leaderboard-component/leaderboard-component.component'; @NgModule({ imports: [ @@ -42,7 +43,8 @@ import { NavbarComponent, ErrorComponent, PageRibbonComponent, - FooterComponent + FooterComponent, + LeaderboardComponentComponent ], providers: [ ProfileService, diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html new file mode 100644 index 0000000..1225a42 --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -0,0 +1,8 @@ +
+ + + SET HOME LOCATION +
diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts new file mode 100644 index 0000000..b94f7ec --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'jhi-leaderboard-component', + templateUrl: './leaderboard-component.component.html', + styles: [] +}) +export class LeaderboardComponentComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} From 9be25f99472fe4c46ad441641549054bdd97089b Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Fri, 25 May 2018 11:16:19 -0300 Subject: [PATCH 02/10] adding component to home screen --- src/main/resources/.h2.server.properties | 4 +- src/main/resources/config/application-dev.yml | 2 +- src/main/webapp/app/app.module.ts | 3 +- .../rfb-location/rfb-location.component.ts | 23 +++++---- src/main/webapp/app/home/home.component.html | 3 ++ src/main/webapp/app/home/home.module.ts | 2 + src/main/webapp/app/home/home.route.ts | 6 +-- .../leaderboard-component.component.html | 17 ++++--- .../leaderboard-component.component.ts | 48 +++++++++++++++++-- src/main/webapp/app/shared/shared.module.ts | 1 + 10 files changed, 81 insertions(+), 28 deletions(-) diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 3237d14..cd53431 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,6 +1,6 @@ #H2 Server Properties -#Sat Nov 04 14:07:31 EDT 2017 -0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:rfbloyalty|rfbloyalty +#Thu May 24 17:31:18 BRT 2018 +0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:file\:~/temp/dabases/rfbloyalty/rfbloyalty|rfbloyalty webAllowOthers=true webPort=8082 webSSL=false diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index fc6215b..8bc47cf 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -26,7 +26,7 @@ spring: serialization.indent_output: true datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:h2:mem:rfbloyalty;DB_CLOSE_DELAY=-1 + url: jdbc:h2:file:~/temp/dabases/rfbloyalty/rfbloyalty;DB_CLOSE_DELAY=-1 username: rfbloyalty password: h2: diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index 3053c64..142282b 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -43,8 +43,7 @@ import { LeaderboardComponentComponent } from './leaderboard-component/leaderboa NavbarComponent, ErrorComponent, PageRibbonComponent, - FooterComponent, - LeaderboardComponentComponent + FooterComponent ], providers: [ ProfileService, diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts index b186461..f1acecd 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts @@ -14,7 +14,7 @@ import {PaginationConfig} from '../../blocks/config/uib-pagination.config'; }) export class RfbLocationComponent implements OnInit, OnDestroy { -currentAccount: any; + currentAccount: any; rfbLocations: RfbLocation[]; error: any; success: any; @@ -53,24 +53,28 @@ currentAccount: any; this.rfbLocationService.query({ page: this.page - 1, size: this.itemsPerPage, - sort: this.sort()}).subscribe( + sort: this.sort() + }).subscribe( (res: ResponseWrapper) => this.onSuccess(res.json, res.headers), (res: ResponseWrapper) => this.onError(res.json) ); } + loadPage(page: number) { if (page !== this.previousPage) { this.previousPage = page; this.transition(); } } + transition() { - this.router.navigate(['/rfb-location'], {queryParams: - { - page: this.page, - size: this.itemsPerPage, - sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') - } + this.router.navigate(['/rfb-location'], { + queryParams: + { + page: this.page, + size: this.itemsPerPage, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } }); this.loadAll(); } @@ -83,6 +87,7 @@ currentAccount: any; }]); this.loadAll(); } + ngOnInit() { this.loadAll(); this.principal.identity().then((account) => { @@ -98,6 +103,7 @@ currentAccount: any; trackId(index: number, item: RfbLocation) { return item.id; } + registerChangeInRfbLocations() { this.eventSubscriber = this.eventManager.subscribe('rfbLocationListModification', (response) => this.loadAll()); } @@ -117,6 +123,7 @@ currentAccount: any; // this.page = pagingParams.page; this.rfbLocations = data; } + private onError(error) { this.alertService.error(error.message, null, null); } diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index 43bccdf..65ed2fa 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -50,5 +50,8 @@

Check-in for today's run!

+ + +
diff --git a/src/main/webapp/app/home/home.module.ts b/src/main/webapp/app/home/home.module.ts index af81dff..ef2fdc2 100644 --- a/src/main/webapp/app/home/home.module.ts +++ b/src/main/webapp/app/home/home.module.ts @@ -4,6 +4,7 @@ import { RouterModule } from '@angular/router'; import { RfbloyaltySharedModule } from '../shared'; import { HOME_ROUTE, HomeComponent } from './'; +import {LeaderboardComponentComponent} from "../leaderboard-component/leaderboard-component.component"; @NgModule({ imports: [ @@ -12,6 +13,7 @@ import { HOME_ROUTE, HomeComponent } from './'; ], declarations: [ HomeComponent, + LeaderboardComponentComponent ], entryComponents: [ ], diff --git a/src/main/webapp/app/home/home.route.ts b/src/main/webapp/app/home/home.route.ts index d2cb491..17ab9e8 100644 --- a/src/main/webapp/app/home/home.route.ts +++ b/src/main/webapp/app/home/home.route.ts @@ -1,7 +1,5 @@ -import { Route } from '@angular/router'; - -import { UserRouteAccessService } from '../shared'; -import { HomeComponent } from './'; +import {Route} from '@angular/router'; +import {HomeComponent} from './'; export const HOME_ROUTE: Route = { path: '', diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html index 1225a42..208e508 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -1,8 +1,11 @@ -
- - - SET HOME LOCATION +
+
+ + +
diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts index b94f7ec..ee7a736 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts @@ -1,4 +1,8 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {RfbEventAttendanceService} from '../entities/rfb-event-attendance'; +import {Principal, ResponseWrapper, UserService} from '../shared'; +import {RfbLocation, RfbLocationService} from '../entities/rfb-location'; +import {JhiAlertService} from 'ng-jhipster'; @Component({ selector: 'jhi-leaderboard-component', @@ -7,9 +11,45 @@ import { Component, OnInit } from '@angular/core'; }) export class LeaderboardComponentComponent implements OnInit { - constructor() { } + actualLocation: RfbLocation; + locationList: RfbLocation[]; - ngOnInit() { - } + constructor( + // private principal: Principal, + // private account: Account, + // private userService: UserService, + private locationService: RfbLocationService, + private evAttdnceService: RfbEventAttendanceService, + private alertService: JhiAlertService + ) { + } + + ngOnInit() { + this.loadAllLocations(); + // this.principal.identity().then((account) => { + // this.account = account; + // this.userService.find(this.principal.identity()).subscribe((user) => { + // this.user = user; + // console.log(this.user[0]); + // }); + // }); + } + + loadAllLocations() { + this.locationService.query({ + sort: ['locationName', 'ASC'] + }).subscribe( + (res: ResponseWrapper) => this.onSuccess(res.json, res.headers), + (res: ResponseWrapper) => this.onError(res.json) + ); + } + + private onSuccess(data, headers) { + this.locationList = data; + } + + private onError(error) { + this.alertService.error(error.message, null, null); + } } diff --git a/src/main/webapp/app/shared/shared.module.ts b/src/main/webapp/app/shared/shared.module.ts index 608327c..c67f191 100644 --- a/src/main/webapp/app/shared/shared.module.ts +++ b/src/main/webapp/app/shared/shared.module.ts @@ -17,6 +17,7 @@ import { SocialService, JhiLoginModalComponent } from './'; +import {LeaderboardComponentComponent} from "../leaderboard-component/leaderboard-component.component"; @NgModule({ imports: [ From 131002b54dcd3079660bbd8b055546c788069fb4 Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Fri, 25 May 2018 16:36:04 -0300 Subject: [PATCH 03/10] user info find (test not ok yet) --- .../com/rfb/service/RfbLocationService.java | 5 ++ .../dto/location/RfbLeaderForLocationDTO.java | 40 +++++++++++ .../service/impl/RfbLocationServiceImpl.java | 70 ++++++++++++++++--- .../com/rfb/web/rest/RfbLocationResource.java | 9 +++ src/main/resources/.h2.server.properties | 2 +- .../leaderboard-component.component.html | 48 ++++++++++++- .../leaderboard-component.component.ts | 18 ++++- .../impl/RfbLocationServiceImplTest.java | 68 ++++++++++++++++++ 8 files changed, 243 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java create mode 100644 src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java diff --git a/src/main/java/com/rfb/service/RfbLocationService.java b/src/main/java/com/rfb/service/RfbLocationService.java index e6d44ff..23daaf4 100644 --- a/src/main/java/com/rfb/service/RfbLocationService.java +++ b/src/main/java/com/rfb/service/RfbLocationService.java @@ -1,9 +1,12 @@ package com.rfb.service; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + /** * Service Interface for managing RfbLocation. */ @@ -39,4 +42,6 @@ public interface RfbLocationService { * @param id the id of the entity */ void delete(Long id); + + List getRfbLeaderForLocation(Long locationId); } diff --git a/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java b/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java new file mode 100644 index 0000000..a53202e --- /dev/null +++ b/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java @@ -0,0 +1,40 @@ +package com.rfb.service.dto.location; + +import java.util.Objects; + +public class RfbLeaderForLocationDTO { + + private String userName; + private int totalRuns; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getTotalRuns() { + return totalRuns; + } + + public void setTotalRuns(int totalRuns) { + this.totalRuns = totalRuns; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RfbLeaderForLocationDTO that = (RfbLeaderForLocationDTO) o; + return getTotalRuns() == that.getTotalRuns() && + Objects.equals(getUserName(), that.getUserName()); + } + + @Override + public int hashCode() { + + return Objects.hash(getUserName(), getTotalRuns()); + } +} diff --git a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java index a088765..b37ba4f 100644 --- a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java +++ b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java @@ -1,10 +1,16 @@ package com.rfb.service.impl; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.rfb.domain.RfbEvent; import com.rfb.domain.RfbLocation; +import com.rfb.domain.User; import com.rfb.repository.RfbLocationRepository; import com.rfb.service.RfbLocationService; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import com.rfb.service.mapper.RfbLocationMapper; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; @@ -12,19 +18,27 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + /** * Service Implementation for managing RfbLocation. */ @Service @Transactional -public class RfbLocationServiceImpl implements RfbLocationService{ +public class RfbLocationServiceImpl implements RfbLocationService { private final Logger log = LoggerFactory.getLogger(RfbLocationServiceImpl.class); - private final RfbLocationRepository rfbLocationRepository; + private RfbLocationRepository rfbLocationRepository; + + private RfbLocationMapper rfbLocationMapper; - private final RfbLocationMapper rfbLocationMapper; + public RfbLocationServiceImpl(){ + + } public RfbLocationServiceImpl(RfbLocationRepository rfbLocationRepository, RfbLocationMapper rfbLocationMapper) { this.rfbLocationRepository = rfbLocationRepository; @@ -46,10 +60,10 @@ public RfbLocationDTO save(RfbLocationDTO rfbLocationDTO) { } /** - * Get all the rfbLocations. + * Get all the rfbLocations. * - * @param pageable the pagination information - * @return the list of entities + * @param pageable the pagination information + * @return the list of entities */ @Override @Transactional(readOnly = true) @@ -60,10 +74,10 @@ public Page findAll(Pageable pageable) { } /** - * Get one rfbLocation by id. + * Get one rfbLocation by id. * - * @param id the id of the entity - * @return the entity + * @param id the id of the entity + * @return the entity */ @Override @Transactional(readOnly = true) @@ -74,13 +88,47 @@ public RfbLocationDTO findOne(Long id) { } /** - * Delete the rfbLocation by id. + * Delete the rfbLocation by id. * - * @param id the id of the entity + * @param id the id of the entity */ @Override public void delete(Long id) { log.debug("Request to delete RfbLocation : {}", id); rfbLocationRepository.delete(id); } + + @Transactional(readOnly = true) + public List getRfbLeaderForLocation(Long locationId) { + List retorno = Lists.newArrayList(); + RfbLocation location = getOneLocation(locationId); + + Map userInfoMap = Maps.newHashMap(); + location.getRvbEvents().stream() + .forEach(event -> { + event.getRfbEventAttendances().stream() + .forEach(evAtt -> { + User user = evAtt.getUser(); + Long userId = user.getId(); + RfbLeaderForLocationDTO dto = userInfoMap.get(userId); + if (dto == null) { + dto = new RfbLeaderForLocationDTO(); + String name = user.getFirstName(); + String lastName = user.getLastName(); + if (StringUtils.isNoneBlank(lastName)) { + name = lastName + ", " + name; + } + dto.setUserName(name); + } else { + dto.setTotalRuns(dto.getTotalRuns() + 1); + } + userInfoMap.put(userId, dto); + }); + }); + return Lists.newArrayList(userInfoMap.values()); + } + + protected RfbLocation getOneLocation(Long locationId) { + return rfbLocationRepository.findOne(locationId); + } } diff --git a/src/main/java/com/rfb/web/rest/RfbLocationResource.java b/src/main/java/com/rfb/web/rest/RfbLocationResource.java index 7a3ccdb..1aeaa1c 100644 --- a/src/main/java/com/rfb/web/rest/RfbLocationResource.java +++ b/src/main/java/com/rfb/web/rest/RfbLocationResource.java @@ -3,6 +3,7 @@ import com.codahale.metrics.annotation.Timed; import com.rfb.service.RfbLocationService; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import com.rfb.web.rest.util.HeaderUtil; import com.rfb.web.rest.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; @@ -122,4 +123,12 @@ public ResponseEntity deleteRfbLocation(@PathVariable Long id) { rfbLocationService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } + + @Timed + @GetMapping("/rfb-locations/{id}") + public ResponseEntity> getRfbLeaderForLocation(@PathVariable Long id) { + log.debug("REST request to get RfbLocation : {}", id); + List rfbLocationDTO = rfbLocationService.getRfbLeaderForLocation(id); + return ResponseUtil.wrapOrNotFound(Optional.ofNullable(rfbLocationDTO)); + } } diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index cd53431..a38b72f 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -#Thu May 24 17:31:18 BRT 2018 +#Fri May 25 14:37:31 BRT 2018 0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:file\:~/temp/dabases/rfbloyalty/rfbloyalty|rfbloyalty webAllowOthers=true webPort=8082 diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html index 208e508..a903069 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -1,11 +1,55 @@
- -
+ +
+ + + + + + + + + + + + + + + + + +
ID Location Name Run Day Of Week
{{rfbLocation.id}}{{rfbLocation.locationName}}{{rfbLocation.runDayOfWeek}} +
+ + + +
+
+
diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts index ee7a736..895da1b 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts @@ -3,14 +3,17 @@ import {RfbEventAttendanceService} from '../entities/rfb-event-attendance'; import {Principal, ResponseWrapper, UserService} from '../shared'; import {RfbLocation, RfbLocationService} from '../entities/rfb-location'; import {JhiAlertService} from 'ng-jhipster'; +import {log} from "util"; +import {forEach} from "@angular/router/src/utils/collection"; @Component({ - selector: 'jhi-leaderboard-component', - templateUrl: './leaderboard-component.component.html', - styles: [] + selector: 'jhi-leaderboard-component', + templateUrl: './leaderboard-component.component.html', + styles: [] }) export class LeaderboardComponentComponent implements OnInit { + actualLocationId: number; actualLocation: RfbLocation; locationList: RfbLocation[]; @@ -44,6 +47,15 @@ export class LeaderboardComponentComponent implements OnInit { ); } + onSelect() { + this.locationService.find(this.actualLocationId).subscribe( + (location: RfbLocation) => { + this.actualLocation = location; + }, + (res: ResponseWrapper) => this.onError(res.json) + ); + } + private onSuccess(data, headers) { this.locationList = data; } diff --git a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java new file mode 100644 index 0000000..46d9b31 --- /dev/null +++ b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java @@ -0,0 +1,68 @@ +package com.rfb.service.impl; + +import com.rfb.domain.RfbEvent; +import com.rfb.domain.RfbEventAttendance; +import com.rfb.domain.RfbLocation; +import com.rfb.domain.User; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; +import org.assertj.core.util.Sets; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; + +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.assertTrue; + +@RunWith(MockitoJUnitRunner.class) +//@ContextConfiguration(classes = { RfbLocationServiceImpl.class }) +//@SpringBootTest(classes = RfbloyaltyApp.class) +public class RfbLocationServiceImplTest { + + @Spy + private RfbLocationServiceImpl service; + + @Test + public void test_getRfbLeaderForLocation() { + + + Long locationId = 1L; + + User firstUser = new User(); + firstUser.setId(1L); + firstUser.setFirstName("Cristian"); + firstUser.setLastName("Chies"); + + User secondUser = new User(); + secondUser.setId(2L); + secondUser.setFirstName("Johny"); + secondUser.setLastName("Jones"); + + RfbLocation location = new RfbLocation(); + Set events = Sets.newHashSet(); + RfbEvent event = new RfbEvent(); + Set eventAttSet = Sets.newHashSet(); + + RfbEventAttendance attnd = new RfbEventAttendance(); + attnd.setUser(firstUser); + eventAttSet.add(attnd); + attnd = new RfbEventAttendance(); + attnd.setUser(secondUser); + eventAttSet.add(attnd); + attnd = new RfbEventAttendance(); + attnd.setUser(secondUser); + eventAttSet.add(attnd); + + event.setRfbEventAttendances(eventAttSet); + location.setRvbEvents(events); + + Mockito.doReturn(location).when(service).getOneLocation(locationId); + List actual = service.getRfbLeaderForLocation(locationId); + + assertTrue(actual.stream().anyMatch(it -> 2 == it.getTotalRuns())); + } + +} From 9b561b78dbe05a3aeab85f5139f460a1bb85654d Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Sat, 26 May 2018 22:51:36 -0300 Subject: [PATCH 04/10] showing runner's ranking on selecting location --- .../service/impl/RfbLocationServiceImpl.java | 59 +++++++++---------- .../com/rfb/web/rest/RfbLocationResource.java | 4 +- .../rfb-location/rfb-location.route.ts | 5 +- .../rfb-location/rfb-location.service.ts | 11 +++- .../leaderboard-component.component.html | 49 ++++----------- .../leaderboard-component.component.ts | 12 ++++ .../rfb-leader-for.location.ts | 7 +++ .../impl/RfbLocationServiceImplTest.java | 11 +++- 8 files changed, 84 insertions(+), 74 deletions(-) create mode 100644 src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts diff --git a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java index b37ba4f..59214a9 100644 --- a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java +++ b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java @@ -2,7 +2,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.rfb.domain.RfbEvent; import com.rfb.domain.RfbLocation; import com.rfb.domain.User; import com.rfb.repository.RfbLocationRepository; @@ -13,6 +12,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -20,7 +20,6 @@ import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** @@ -32,18 +31,12 @@ public class RfbLocationServiceImpl implements RfbLocationService { private final Logger log = LoggerFactory.getLogger(RfbLocationServiceImpl.class); + @Autowired private RfbLocationRepository rfbLocationRepository; + @Autowired private RfbLocationMapper rfbLocationMapper; - public RfbLocationServiceImpl(){ - - } - - public RfbLocationServiceImpl(RfbLocationRepository rfbLocationRepository, RfbLocationMapper rfbLocationMapper) { - this.rfbLocationRepository = rfbLocationRepository; - this.rfbLocationMapper = rfbLocationMapper; - } /** * Save a rfbLocation. @@ -100,31 +93,37 @@ public void delete(Long id) { @Transactional(readOnly = true) public List getRfbLeaderForLocation(Long locationId) { - List retorno = Lists.newArrayList(); + if (locationId == null) { + throw new IllegalArgumentException("location id not informed"); + } RfbLocation location = getOneLocation(locationId); + if (location == null) { + throw new IllegalArgumentException("location id not informed"); + } Map userInfoMap = Maps.newHashMap(); location.getRvbEvents().stream() - .forEach(event -> { - event.getRfbEventAttendances().stream() - .forEach(evAtt -> { - User user = evAtt.getUser(); - Long userId = user.getId(); - RfbLeaderForLocationDTO dto = userInfoMap.get(userId); - if (dto == null) { - dto = new RfbLeaderForLocationDTO(); - String name = user.getFirstName(); - String lastName = user.getLastName(); - if (StringUtils.isNoneBlank(lastName)) { - name = lastName + ", " + name; - } - dto.setUserName(name); - } else { - dto.setTotalRuns(dto.getTotalRuns() + 1); + .forEach(event -> event.getRfbEventAttendances().stream() + .forEach(evAtt -> { + User user = evAtt.getUser(); + Long userId = user.getId(); + RfbLeaderForLocationDTO dto = userInfoMap.get(userId); + int totalRuns = 1; + if (dto == null) { + dto = new RfbLeaderForLocationDTO(); + String name = user.getFirstName(); + String lastName = user.getLastName(); + if (StringUtils.isNoneBlank(lastName)) { + name = lastName + ", " + name; } - userInfoMap.put(userId, dto); - }); - }); + dto.setUserName(name); + dto.setTotalRuns(totalRuns); + } else { + totalRuns += 1; + } + dto.setTotalRuns(totalRuns); + userInfoMap.put(userId, dto); + })); return Lists.newArrayList(userInfoMap.values()); } diff --git a/src/main/java/com/rfb/web/rest/RfbLocationResource.java b/src/main/java/com/rfb/web/rest/RfbLocationResource.java index 1aeaa1c..d16a132 100644 --- a/src/main/java/com/rfb/web/rest/RfbLocationResource.java +++ b/src/main/java/com/rfb/web/rest/RfbLocationResource.java @@ -125,10 +125,10 @@ public ResponseEntity deleteRfbLocation(@PathVariable Long id) { } @Timed - @GetMapping("/rfb-locations/{id}") + @GetMapping("/rfb-locations/{id}/leaders") public ResponseEntity> getRfbLeaderForLocation(@PathVariable Long id) { log.debug("REST request to get RfbLocation : {}", id); List rfbLocationDTO = rfbLocationService.getRfbLeaderForLocation(id); - return ResponseUtil.wrapOrNotFound(Optional.ofNullable(rfbLocationDTO)); + return new ResponseEntity<>(rfbLocationDTO, HttpStatus.OK); } } diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts index 6c5d2fe..e521d61 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts @@ -12,7 +12,8 @@ import {RfbLocationDeletePopupComponent} from './rfb-location-delete-dialog.comp @Injectable() export class RfbLocationResolvePagingParams implements Resolve { - constructor(private paginationUtil: JhiPaginationUtil) {} + constructor(private paginationUtil: JhiPaginationUtil) { + } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const page = route.queryParams['page'] ? route.queryParams['page'] : '1'; @@ -21,7 +22,7 @@ export class RfbLocationResolvePagingParams implements Resolve { page: this.paginationUtil.parsePage(page), predicate: this.paginationUtil.parsePredicate(sort), ascending: this.paginationUtil.parseAscending(sort) - }; + }; } } diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts index f8f24f4..26be198 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts @@ -5,13 +5,15 @@ import {SERVER_API_URL} from '../../app.constants'; import {RfbLocation} from './rfb-location.model'; import {createRequestOption, ResponseWrapper} from '../../shared'; +import {RfbLeaderForLocation} from "../../leaderboard-component/rfb-leader-for.location"; @Injectable() export class RfbLocationService { private resourceUrl = SERVER_API_URL + 'api/rfb-locations'; - constructor(private http: Http) { } + constructor(private http: Http) { + } create(rfbLocation: RfbLocation): Observable { const copy = this.convert(rfbLocation); @@ -43,6 +45,13 @@ export class RfbLocationService { return this.http.delete(`${this.resourceUrl}/${id}`); } + getRfbLeaderForLocation(id: number, req?: any): Observable { + const options = createRequestOption(req); + return this.http.get(`${this.resourceUrl}/${id}/leaders`, options) + .map((res: Response) => this.convertResponse(res)); + } + + private convertResponse(res: Response): ResponseWrapper { const jsonResponse = res.json(); return new ResponseWrapper(res.headers, jsonResponse, res.status); diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html index a903069..94c6bd1 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -1,53 +1,28 @@ +
- - -
-
+
- - - - - + + + - - - - - + + +
ID Location Name Run Day Of Week
Runner's Name Total of Runs
{{rfbLocation.id}}{{rfbLocation.locationName}}{{rfbLocation.runDayOfWeek}} -
- - - -
-
{{leader.userName}}{{leader.totalRuns}}
diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts index 895da1b..4ebfeb1 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts @@ -5,6 +5,7 @@ import {RfbLocation, RfbLocationService} from '../entities/rfb-location'; import {JhiAlertService} from 'ng-jhipster'; import {log} from "util"; import {forEach} from "@angular/router/src/utils/collection"; +import {RfbLeaderForLocation} from "./rfb-leader-for.location"; @Component({ selector: 'jhi-leaderboard-component', @@ -16,6 +17,7 @@ export class LeaderboardComponentComponent implements OnInit { actualLocationId: number; actualLocation: RfbLocation; locationList: RfbLocation[]; + leaderList: RfbLeaderForLocation[]; constructor( // private principal: Principal, @@ -50,12 +52,22 @@ export class LeaderboardComponentComponent implements OnInit { onSelect() { this.locationService.find(this.actualLocationId).subscribe( (location: RfbLocation) => { + console.log('location' + location); this.actualLocation = location; + this.getRfbLeaderForLocation(); }, (res: ResponseWrapper) => this.onError(res.json) ); } + getRfbLeaderForLocation() { + this.locationService.getRfbLeaderForLocation(this.actualLocationId).subscribe( + (res: ResponseWrapper) => + this.leaderList = res.json, + (res: ResponseWrapper) => this.onError(res.json) + ); + } + private onSuccess(data, headers) { this.locationList = data; } diff --git a/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts b/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts new file mode 100644 index 0000000..b880ede --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts @@ -0,0 +1,7 @@ +export class RfbLeaderForLocation { + constructor( + public userName?: string, + public totalRuns?: number + ) { + } +} diff --git a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java index 46d9b31..2fbc8a5 100644 --- a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java +++ b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java @@ -55,14 +55,21 @@ public void test_getRfbLeaderForLocation() { attnd = new RfbEventAttendance(); attnd.setUser(secondUser); eventAttSet.add(attnd); - event.setRfbEventAttendances(eventAttSet); + events.add(event); + location.setRvbEvents(events); Mockito.doReturn(location).when(service).getOneLocation(locationId); List actual = service.getRfbLeaderForLocation(locationId); - assertTrue(actual.stream().anyMatch(it -> 2 == it.getTotalRuns())); + assertTrue( + actual + .stream() + .anyMatch( + it -> 2 == it.getTotalRuns() && "Jones, Johny".equals(it.getUserName()) + ) + ); } } From 7acf94e1068273a87e0b2317cb8e2a60becc208c Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Sat, 26 May 2018 23:10:50 -0300 Subject: [PATCH 05/10] some text and style --- .../leaderboard-component/leaderboard-component.component.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html index 94c6bd1..d66d2d8 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -1,7 +1,8 @@
- +

Location's Ranking

+

Please select a Location to see it's Ranking.

-
+
diff --git a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java index 2fbc8a5..338f5fe 100644 --- a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java +++ b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java @@ -15,6 +15,8 @@ import java.util.List; import java.util.Set; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @RunWith(MockitoJUnitRunner.class) @@ -53,7 +55,7 @@ public void test_getRfbLeaderForLocation() { attnd.setUser(secondUser); eventAttSet.add(attnd); attnd = new RfbEventAttendance(); - attnd.setUser(secondUser); + attnd.setUser(secondUser);// adding 2 counts for second user eventAttSet.add(attnd); event.setRfbEventAttendances(eventAttSet); events.add(event); @@ -63,13 +65,12 @@ public void test_getRfbLeaderForLocation() { Mockito.doReturn(location).when(service).getOneLocation(locationId); List actual = service.getRfbLeaderForLocation(locationId); - assertTrue( - actual - .stream() - .anyMatch( - it -> 2 == it.getTotalRuns() && "Jones, Johny".equals(it.getUserName()) - ) - ); + assertNotNull(actual); + assertTrue(actual.size() > 0); + // as it must be sorted by 'running count' the first position must have the highest running count + RfbLeaderForLocationDTO actualData = actual.get(0); + assertEquals(2, actualData.getTotalRuns()); + assertEquals(secondUser.getLastName() + ", " + secondUser.getFirstName(), actualData.getUserName()); } } From a599089cf270016a8ce11e2be10d7753771387ea Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Mon, 28 May 2018 11:13:44 -0300 Subject: [PATCH 07/10] setting back database url config --- src/main/resources/config/application-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 8bc47cf..fc6215b 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -26,7 +26,7 @@ spring: serialization.indent_output: true datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:h2:file:~/temp/dabases/rfbloyalty/rfbloyalty;DB_CLOSE_DELAY=-1 + url: jdbc:h2:mem:rfbloyalty;DB_CLOSE_DELAY=-1 username: rfbloyalty password: h2: From 9acb4a05b58b36d16cd7defa746dfa72121ebee7 Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Mon, 28 May 2018 11:42:46 -0300 Subject: [PATCH 08/10] double quotes fix --- .../rfb-location/rfb-location.service.ts | 2 -- src/main/webapp/app/home/home.module.ts | 2 +- .../leaderboard-component.component.html | 7 +++--- .../leaderboard-component.component.ts | 16 ++---------- src/main/webapp/app/shared/shared.module.ts | 25 +++++++++---------- 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts index 26be198..119217d 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts @@ -5,7 +5,6 @@ import {SERVER_API_URL} from '../../app.constants'; import {RfbLocation} from './rfb-location.model'; import {createRequestOption, ResponseWrapper} from '../../shared'; -import {RfbLeaderForLocation} from "../../leaderboard-component/rfb-leader-for.location"; @Injectable() export class RfbLocationService { @@ -51,7 +50,6 @@ export class RfbLocationService { .map((res: Response) => this.convertResponse(res)); } - private convertResponse(res: Response): ResponseWrapper { const jsonResponse = res.json(); return new ResponseWrapper(res.headers, jsonResponse, res.status); diff --git a/src/main/webapp/app/home/home.module.ts b/src/main/webapp/app/home/home.module.ts index ef2fdc2..edb9655 100644 --- a/src/main/webapp/app/home/home.module.ts +++ b/src/main/webapp/app/home/home.module.ts @@ -4,7 +4,7 @@ import { RouterModule } from '@angular/router'; import { RfbloyaltySharedModule } from '../shared'; import { HOME_ROUTE, HomeComponent } from './'; -import {LeaderboardComponentComponent} from "../leaderboard-component/leaderboard-component.component"; +import {LeaderboardComponentComponent} from '../leaderboard-component/leaderboard-component.component'; @NgModule({ imports: [ diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html index 11d7127..6a48760 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html @@ -11,13 +11,12 @@

Location's Ranking

-
- - - + + + diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts index 4ebfeb1..ee386f7 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts +++ b/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts @@ -1,11 +1,9 @@ import {Component, OnInit} from '@angular/core'; import {RfbEventAttendanceService} from '../entities/rfb-event-attendance'; -import {Principal, ResponseWrapper, UserService} from '../shared'; +import {ResponseWrapper} from '../shared'; import {RfbLocation, RfbLocationService} from '../entities/rfb-location'; import {JhiAlertService} from 'ng-jhipster'; -import {log} from "util"; -import {forEach} from "@angular/router/src/utils/collection"; -import {RfbLeaderForLocation} from "./rfb-leader-for.location"; +import {RfbLeaderForLocation} from './rfb-leader-for.location'; @Component({ selector: 'jhi-leaderboard-component', @@ -20,9 +18,6 @@ export class LeaderboardComponentComponent implements OnInit { leaderList: RfbLeaderForLocation[]; constructor( - // private principal: Principal, - // private account: Account, - // private userService: UserService, private locationService: RfbLocationService, private evAttdnceService: RfbEventAttendanceService, private alertService: JhiAlertService @@ -31,13 +26,6 @@ export class LeaderboardComponentComponent implements OnInit { ngOnInit() { this.loadAllLocations(); - // this.principal.identity().then((account) => { - // this.account = account; - // this.userService.find(this.principal.identity()).subscribe((user) => { - // this.user = user; - // console.log(this.user[0]); - // }); - // }); } loadAllLocations() { diff --git a/src/main/webapp/app/shared/shared.module.ts b/src/main/webapp/app/shared/shared.module.ts index c67f191..2f5beec 100644 --- a/src/main/webapp/app/shared/shared.module.ts +++ b/src/main/webapp/app/shared/shared.module.ts @@ -1,23 +1,22 @@ -import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { DatePipe } from '@angular/common'; +import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core'; +import {DatePipe} from '@angular/common'; import { - RfbloyaltySharedLibsModule, - RfbloyaltySharedCommonModule, - CSRFService, - AuthServerProvider, AccountService, - UserService, - StateStorageService, - LoginService, - LoginModalService, - Principal, + AuthServerProvider, + CSRFService, HasAnyAuthorityDirective, + JhiLoginModalComponent, JhiSocialComponent, + LoginModalService, + LoginService, + Principal, + RfbloyaltySharedCommonModule, + RfbloyaltySharedLibsModule, SocialService, - JhiLoginModalComponent + StateStorageService, + UserService } from './'; -import {LeaderboardComponentComponent} from "../leaderboard-component/leaderboard-component.component"; @NgModule({ imports: [ From aa6ed6bf77c6f8510257105c4ba52af4e169ab85 Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Mon, 28 May 2018 11:46:02 -0300 Subject: [PATCH 09/10] removing footer from home.component --- src/main/webapp/app/home/home.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index 65ed2fa..db0d249 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -51,7 +51,6 @@

Check-in for today's run!

-
From c1551cd7832f8f98fdbf131c63549fcbc06ebf5f Mon Sep 17 00:00:00 2001 From: Cristian Chies Date: Mon, 28 May 2018 13:25:51 -0300 Subject: [PATCH 10/10] renaming component --- src/main/webapp/app/app.module.ts | 32 +++++++++---------- src/main/webapp/app/home/home.module.ts | 4 +-- ...ponent.html => leaderboard.component.html} | 0 ....component.ts => leaderboard.component.ts} | 4 +-- 4 files changed, 19 insertions(+), 21 deletions(-) rename src/main/webapp/app/leaderboard-component/{leaderboard-component.component.html => leaderboard.component.html} (100%) rename src/main/webapp/app/leaderboard-component/{leaderboard-component.component.ts => leaderboard.component.ts} (94%) diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index 142282b..86f0ec7 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -1,30 +1,28 @@ import './vendor.ts'; -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { Ng2Webstorage } from 'ng2-webstorage'; +import {NgModule} from '@angular/core'; +import {BrowserModule} from '@angular/platform-browser'; +import {Ng2Webstorage} from 'ng2-webstorage'; -import { RfbloyaltySharedModule, UserRouteAccessService } from './shared'; -import { RfbloyaltyHomeModule } from './home/home.module'; -import { RfbloyaltyAdminModule } from './admin/admin.module'; -import { RfbloyaltyAccountModule } from './account/account.module'; -import { RfbloyaltyEntityModule } from './entities/entity.module'; - -import { customHttpProvider } from './blocks/interceptor/http.provider'; -import { PaginationConfig } from './blocks/config/uib-pagination.config'; - -// jhipster-needle-angular-add-module-import JHipster will add new module here +import {RfbloyaltySharedModule, UserRouteAccessService} from './shared'; +import {RfbloyaltyHomeModule} from './home'; +import {RfbloyaltyAdminModule} from './admin/admin.module'; +import {RfbloyaltyAccountModule} from './account/account.module'; +import {RfbloyaltyEntityModule} from './entities/entity.module'; +import {customHttpProvider} from './blocks/interceptor/http.provider'; +import {PaginationConfig} from './blocks/config/uib-pagination.config'; import { + ErrorComponent, + FooterComponent, JhiMainComponent, LayoutRoutingModule, NavbarComponent, - FooterComponent, - ProfileService, PageRibbonComponent, - ErrorComponent + ProfileService } from './layouts'; -import { LeaderboardComponentComponent } from './leaderboard-component/leaderboard-component.component'; + +// jhipster-needle-angular-add-module-import JHipster will add new module here @NgModule({ imports: [ diff --git a/src/main/webapp/app/home/home.module.ts b/src/main/webapp/app/home/home.module.ts index edb9655..a9fca5a 100644 --- a/src/main/webapp/app/home/home.module.ts +++ b/src/main/webapp/app/home/home.module.ts @@ -4,7 +4,7 @@ import { RouterModule } from '@angular/router'; import { RfbloyaltySharedModule } from '../shared'; import { HOME_ROUTE, HomeComponent } from './'; -import {LeaderboardComponentComponent} from '../leaderboard-component/leaderboard-component.component'; +import {LeaderboardComponent} from '../leaderboard-component/leaderboard.component'; @NgModule({ imports: [ @@ -13,7 +13,7 @@ import {LeaderboardComponentComponent} from '../leaderboard-component/leaderboar ], declarations: [ HomeComponent, - LeaderboardComponentComponent + LeaderboardComponent ], entryComponents: [ ], diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.html b/src/main/webapp/app/leaderboard-component/leaderboard.component.html similarity index 100% rename from src/main/webapp/app/leaderboard-component/leaderboard-component.component.html rename to src/main/webapp/app/leaderboard-component/leaderboard.component.html diff --git a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard.component.ts similarity index 94% rename from src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts rename to src/main/webapp/app/leaderboard-component/leaderboard.component.ts index ee386f7..ea9e4e9 100644 --- a/src/main/webapp/app/leaderboard-component/leaderboard-component.component.ts +++ b/src/main/webapp/app/leaderboard-component/leaderboard.component.ts @@ -7,10 +7,10 @@ import {RfbLeaderForLocation} from './rfb-leader-for.location'; @Component({ selector: 'jhi-leaderboard-component', - templateUrl: './leaderboard-component.component.html', + templateUrl: './leaderboard.component.html', styles: [] }) -export class LeaderboardComponentComponent implements OnInit { +export class LeaderboardComponent implements OnInit { actualLocationId: number; actualLocation: RfbLocation;
Runner's Name Total of Runs
Runner's Name Total of Runs