Ajout d'un reset des stats de l'utilisateur
après l'ajout ou la suppression de sauts.
This commit is contained in:
@@ -9,6 +9,7 @@ import { Jump } from '../../models/jump';
|
|||||||
import { JumpService } from '../../services/jump.service';
|
import { JumpService } from '../../services/jump.service';
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from '../../services/service-comm.service';
|
||||||
import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
|
import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
|
||||||
|
import { StatsService } from '../../services/stats.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-of-jumps',
|
selector: 'app-list-of-jumps',
|
||||||
@@ -32,7 +33,8 @@ export class ListOfJumpsComponent implements OnInit {
|
|||||||
constructor(private serviceApi: JumpService,
|
constructor(private serviceApi: JumpService,
|
||||||
private serviceComm: ServiceComm,
|
private serviceComm: ServiceComm,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private translateService: TranslateService) { }
|
private translateService: TranslateService,
|
||||||
|
private statsService : StatsService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.refreshRequest.subscribe(action => {
|
this.serviceComm.refreshRequest.subscribe(action => {
|
||||||
@@ -85,6 +87,7 @@ export class ListOfJumpsComponent implements OnInit {
|
|||||||
this.resultsLength = data.length;
|
this.resultsLength = data.length;
|
||||||
|
|
||||||
this.serviceApi.DeleteJump(item);
|
this.serviceApi.DeleteJump(item);
|
||||||
|
this.statsService.resetStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle() {
|
private updateTitle() {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { AircraftService } from "../../services/aircraft.service";
|
|||||||
import { JumpService } from "../../services/jump.service";
|
import { JumpService } from "../../services/jump.service";
|
||||||
import { JumpTypeService } from "../../services/jump-type.service";
|
import { JumpTypeService } from "../../services/jump-type.service";
|
||||||
import { GearService } from "../../services/gear.service";
|
import { GearService } from "../../services/gear.service";
|
||||||
|
import { StatsService } from "../../services/stats.service";
|
||||||
|
|
||||||
|
|
||||||
export const PICK_FORMATS = {
|
export const PICK_FORMATS = {
|
||||||
@@ -70,7 +71,8 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private serviceDropzone: DropzoneService,
|
private serviceDropzone: DropzoneService,
|
||||||
private serviceGear: GearService,
|
private serviceGear: GearService,
|
||||||
private dateService: DateService,
|
private dateService: DateService,
|
||||||
private translateService: TranslateService) {}
|
private translateService: TranslateService,
|
||||||
|
private statsService : StatsService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.forceTranslateTitle.subscribe((data)=> {
|
this.serviceComm.forceTranslateTitle.subscribe((data)=> {
|
||||||
@@ -101,6 +103,7 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.comments,
|
this.comments,
|
||||||
this.isSpecial === undefined ? false : this.isSpecial)
|
this.isSpecial === undefined ? false : this.isSpecial)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
|
this.statsService.resetStats();
|
||||||
this.comments = undefined;
|
this.comments = undefined;
|
||||||
this.withCutaway = false;
|
this.withCutaway = false;
|
||||||
this.isSpecial = false;
|
this.isSpecial = false;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class ServiceCacheApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get<T>(key: CacheApiKey, callToApi: Observable<T>) : Observable<T> {
|
public get<T>(key: CacheApiKey, callToApi: Observable<T>) : Observable<T> {
|
||||||
console.log(`Get/push cache : ${CacheApiKey[key]}`);
|
// console.log(`Get/push cache : ${CacheApiKey[key]}`);
|
||||||
const cached = this.cache.get(key);
|
const cached = this.cache.get(key);
|
||||||
|
|
||||||
if (cached) {
|
if (cached) {
|
||||||
@@ -29,12 +29,12 @@ export class ServiceCacheApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public delete(key: CacheApiKey) {
|
public delete(key: CacheApiKey) {
|
||||||
console.log(`Delete cache : ${CacheApiKey[key]}`);
|
// console.log(`Delete cache : ${CacheApiKey[key]}`);
|
||||||
this.cache.delete(key);
|
this.cache.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getByKey<T>(key: CacheApiKey) : Observable<T> {
|
public getByKey<T>(key: CacheApiKey) : Observable<T> {
|
||||||
console.log(`Get cache by key : ${CacheApiKey[key]}`);
|
// console.log(`Get cache by key : ${CacheApiKey[key]}`);
|
||||||
return this.cache.get(key);
|
return this.cache.get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ export class StatsService extends BaseService {
|
|||||||
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth);
|
this.serviceCacheApi.delete(CacheApiKey.StatsOfLastMonth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public resetStats() {
|
||||||
|
this.http.get(`${this.apiUrl}/Stats/Reset`, { headers: this.headers }).subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
public getSimpleSummary(): Observable<SimpleSummary> {
|
public getSimpleSummary(): Observable<SimpleSummary> {
|
||||||
let callToApi = this.http.get<SimpleSummaryResp>(`${this.apiUrl}/Stats/Simple`, { headers: this.headers })
|
let callToApi = this.http.get<SimpleSummaryResp>(`${this.apiUrl}/Stats/Simple`, { headers: this.headers })
|
||||||
.pipe(map(response => {
|
.pipe(map(response => {
|
||||||
|
|||||||
Reference in New Issue
Block a user