Rename the methods
This commit is contained in:
@@ -46,7 +46,7 @@ export class DefaultComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("Default_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,12 @@ export class JumpInfosComponent implements OnInit {
|
||||
ngOnInit(): void {}
|
||||
|
||||
public updateJump() {
|
||||
this.serviceJump.UpdateJump(this.jump.id,
|
||||
this.serviceJump.updateJump(this.jump.id,
|
||||
this.jump.isSpecial,
|
||||
this.jump.withCutaway,
|
||||
this.jump.notes)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.RefreshData(AddAction.Jump);
|
||||
this.serviceComm.refreshData(AddAction.Jump);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListAircrafts_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export class ListOfDzsComponent implements OnInit {
|
||||
|
||||
public setToFavorite(dropzone: DropZoneResp) {
|
||||
dropzone.isFavorite = true;
|
||||
this.serviceApi.SetFavoriteDropZone(dropzone);
|
||||
this.serviceApi.setFavoriteDropZone(dropzone);
|
||||
|
||||
const data = this.dataSourceTable.data;
|
||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
|
||||
@@ -77,7 +77,7 @@ export class ListOfDzsComponent implements OnInit {
|
||||
|
||||
public removeToFavorite(dropzone: DropZoneResp) {
|
||||
dropzone.isFavorite = false;
|
||||
this.serviceApi.RemoveFavoriteDropZone(dropzone);
|
||||
this.serviceApi.removeFavoriteDropZone(dropzone);
|
||||
|
||||
const data = this.dataSourceTable.data;
|
||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
|
||||
@@ -99,7 +99,7 @@ export class ListOfDzsComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListDz_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ export class ListOfGearsComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListGears_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ export class ListOfImagesComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.serviceApi.AddImage(formData.comment, this.selectedFile)
|
||||
this.serviceApi.addImage(formData.comment, this.selectedFile)
|
||||
.subscribe(
|
||||
() => { this.getListOfImages(); }
|
||||
);
|
||||
|
||||
@@ -65,7 +65,7 @@ export class ListOfJumpTypesComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListJumpTypes_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
|
||||
this.isLoading = true;
|
||||
|
||||
this.serviceApi.GetJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
||||
this.serviceApi.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
||||
.subscribe((data) => {
|
||||
this.dataSourceTable.data = data.rows;
|
||||
setTimeout(() => {
|
||||
@@ -86,7 +86,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
|
||||
this.dataSourceTable.data = data;
|
||||
|
||||
this.serviceApi.DeleteJump(item);
|
||||
this.serviceApi.deleteJump(item);
|
||||
this.statsService.resetStats();
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export class ListOfJumpsComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListJumps_Title").subscribe((data) => {
|
||||
this.serviceComm.UpdatedComponentTitle(data);
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class ListOfTunnelFlightsComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListTunnelFlight_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ export class NewAircraftComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.serviceApi.AddAircraft(formData.aircraftName, this.selectedFile)
|
||||
this.serviceApi.addAircraft(formData.aircraftName, this.selectedFile)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.RefreshData(AddAction.Aircraft);
|
||||
this.serviceComm.refreshData(AddAction.Aircraft);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export class NewDropZoneComponent implements OnInit {
|
||||
dzType.push("tunnel");
|
||||
}
|
||||
|
||||
this.dropzoneService.AddDropZone(splitGps[0],
|
||||
this.dropzoneService.addDropZone(splitGps[0],
|
||||
splitGps[1],
|
||||
formData.dzName,
|
||||
formData.address,
|
||||
@@ -58,7 +58,7 @@ export class NewDropZoneComponent implements OnInit {
|
||||
dzType,
|
||||
false)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.RefreshData(AddAction.Dropzone);
|
||||
this.serviceComm.refreshData(AddAction.Dropzone);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export class NewGearComponent implements OnInit {
|
||||
ngOnInit() { }
|
||||
|
||||
onSubmit(formData) {
|
||||
this.serviceApi.AddGear(formData.name,
|
||||
this.serviceApi.addGear(formData.name,
|
||||
formData.manufacturer,
|
||||
+formData.minSize,
|
||||
+formData.maxSize,
|
||||
@@ -57,7 +57,7 @@ export class NewGearComponent implements OnInit {
|
||||
formData.mainCanopy,
|
||||
formData.reserveCanopy)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.RefreshData(AddAction.Gear);
|
||||
this.serviceComm.refreshData(AddAction.Gear);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ export class NewJumpTypeComponent implements OnInit {
|
||||
ngOnInit() { }
|
||||
|
||||
onSubmit(formData) {
|
||||
this.jumpTypeService.AddJumpType(formData.jumptypeName)
|
||||
this.jumpTypeService.addJumpType(formData.jumptypeName)
|
||||
.subscribe(() => {
|
||||
this.serviceComm.RefreshData(AddAction.JumpType);
|
||||
this.serviceComm.refreshData(AddAction.JumpType);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export class NewJumpComponent implements OnInit {
|
||||
onFormSubmit() {
|
||||
this.pendingAddRequest = true;
|
||||
|
||||
this.serviceJump.AddListOfJump(this.selectedJumpType.id,
|
||||
this.serviceJump.addListOfJump(this.selectedJumpType.id,
|
||||
this.selectedAircraft.id,
|
||||
this.selectedDz.id,
|
||||
this.selectedGear.id,
|
||||
@@ -172,7 +172,7 @@ export class NewJumpComponent implements OnInit {
|
||||
private initForm() {
|
||||
this.endDate = new Date();
|
||||
this.endDate.setHours(0, 0, 0, 0);
|
||||
this.beginDate = this.dateService.AddDays(this.endDate, -1);
|
||||
this.beginDate = this.dateService.addDays(this.endDate, -1);
|
||||
|
||||
this.exitAltitude = 4000;
|
||||
this.deployAltitude = 1000;
|
||||
@@ -225,7 +225,7 @@ export class NewJumpComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("NewJump_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export class SummaryComponent implements OnInit {
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("Summary_Title").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
data => { this.serviceComm.updatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class AircraftService extends BaseService {
|
||||
return this.serviceCacheApi.get<Array<AircraftResp>>(CacheApiKey.Aircraft, callToApi);
|
||||
}
|
||||
|
||||
public AddAircraft(aircraftName: string, dataImg: string) {
|
||||
public addAircraft(aircraftName: string, dataImg: string) {
|
||||
const bodyNewAircraft: AircraftReq = {
|
||||
id: 0,
|
||||
name: aircraftName,
|
||||
|
||||
@@ -8,7 +8,7 @@ export class DateService {
|
||||
this.milliSeconInDay = 1000 * 60 * 60 * 24;
|
||||
}
|
||||
|
||||
public AddDays(currentDate: Date, nbDays: number): Date {
|
||||
public addDays(currentDate: Date, nbDays: number): Date {
|
||||
const totalMilliSeconds = nbDays * this.milliSeconInDay;
|
||||
const currentTime = currentDate.getTime();
|
||||
const tmpDate = new Date(currentDate.getTime());
|
||||
@@ -18,7 +18,7 @@ export class DateService {
|
||||
return tmpDate;
|
||||
}
|
||||
|
||||
public DiffBetweenDates(beginDate: Date, endDate: Date): number {
|
||||
public diffBetweenDates(beginDate: Date, endDate: Date): number {
|
||||
const diffInTime = endDate.getTime() - beginDate.getTime();
|
||||
const diffInDays = Math.round(diffInTime / (1000 * 3600 * 24));
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class DropzoneService extends BaseService {
|
||||
return this.serviceCacheApi.get<Array<DropZoneResp>>(CacheApiKey.Dropzone, callToApi);
|
||||
}
|
||||
|
||||
public SetFavoriteDropZone(selectedDz: DropZoneResp) {
|
||||
public setFavoriteDropZone(selectedDz: DropZoneResp) {
|
||||
selectedDz.isFavorite = true;
|
||||
|
||||
this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`,
|
||||
@@ -41,7 +41,7 @@ export class DropzoneService extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
public RemoveFavoriteDropZone(selectedDz: DropZoneResp) {
|
||||
public removeFavoriteDropZone(selectedDz: DropZoneResp) {
|
||||
selectedDz.isFavorite = false;
|
||||
|
||||
this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`,
|
||||
@@ -52,7 +52,7 @@ export class DropzoneService extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
public AddDropZone(latitude: string,
|
||||
public addDropZone(latitude: string,
|
||||
longitude: string,
|
||||
name: string,
|
||||
address: string,
|
||||
|
||||
@@ -19,7 +19,7 @@ export class GearService extends BaseService {
|
||||
return this.serviceCacheApi.get<Array<GearResp>>(CacheApiKey.Gear, callToApi);
|
||||
}
|
||||
|
||||
public AddGear(name: string,
|
||||
public addGear(name: string,
|
||||
manufacturer: string,
|
||||
minSize: number,
|
||||
maxSize: number,
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ImageService extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
public AddImage(commentImg: string, dataImg: string) {
|
||||
public addImage(commentImg: string, dataImg: string) {
|
||||
const bodyNewImage: ImageReq = {
|
||||
id: 0,
|
||||
comment: commentImg,
|
||||
|
||||
@@ -19,7 +19,7 @@ export class JumpTypeService extends BaseService {
|
||||
return this.serviceCacheApi.get<Array<JumpTypeResp>>(CacheApiKey.JumpType, callToApi);
|
||||
}
|
||||
|
||||
public AddJumpType(jumptypetName: string) {
|
||||
public addJumpType(jumptypetName: string) {
|
||||
const bodyJumpType: JumpTypeReq = {
|
||||
id: 0,
|
||||
name: jumptypetName
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { forkJoin, Observable, of } from "rxjs";
|
||||
import { forkJoin, Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
|
||||
import { JumpResp, JumpReq, Jump } from "../models/jump";
|
||||
@@ -32,20 +32,18 @@ export class JumpService extends BaseService {
|
||||
super();
|
||||
}
|
||||
|
||||
public GetListOfJumps(): Observable<Array<Jump>> {
|
||||
return this.http.get<Array<JumpResp>>(`${this.apiUrl}/Jump`,
|
||||
{ headers: this.headers })
|
||||
public getListOfJumps(): Observable<Array<Jump>> {
|
||||
return this.http.get<Array<JumpResp>>(`${this.apiUrl}/Jump`, { headers: this.headers })
|
||||
.pipe(map((response) => {
|
||||
return this.MapWithDataInCache(response);
|
||||
return this.mapWithDataInCache(response);
|
||||
}));
|
||||
}
|
||||
|
||||
public GetJumps(beginIndex: number, endIndex: number): Observable<JumpList> {
|
||||
return this.http.get<JumpListResp>(`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`,
|
||||
{ headers: this.headers })
|
||||
public getJumps(beginIndex: number, endIndex: number): Observable<JumpList> {
|
||||
return this.http.get<JumpListResp>(`${this.apiUrl}/Jump/${beginIndex}/${endIndex}`, { headers: this.headers })
|
||||
.pipe(map((response) => {
|
||||
let result: JumpList = {
|
||||
rows: this.MapWithDataInCache(response.rows),
|
||||
rows: this.mapWithDataInCache(response.rows),
|
||||
count: response.count
|
||||
};
|
||||
|
||||
@@ -53,7 +51,7 @@ export class JumpService extends BaseService {
|
||||
}));
|
||||
}
|
||||
|
||||
public AddListOfJump(selectedJumpType: number,
|
||||
public addListOfJump(selectedJumpType: number,
|
||||
selectedAircraft: number,
|
||||
selectedDz: number,
|
||||
selectedRig: number,
|
||||
@@ -66,11 +64,11 @@ export class JumpService extends BaseService {
|
||||
notes: string,
|
||||
isSpecial: boolean): Observable<any[]> {
|
||||
this.callsToAdd = new Array<Observable<any>>();
|
||||
const diffInDays = this.dateService.DiffBetweenDates(beginDate, endDate) + 1;
|
||||
const diffInDays = this.dateService.diffBetweenDates(beginDate, endDate) + 1;
|
||||
const countOfJumpsPerDay = Math.trunc(countOfJumps / diffInDays);
|
||||
|
||||
for (let i = 1; beginDate.getTime() < endDate.getTime(); i++) {
|
||||
this.AddJumps(selectedJumpType,
|
||||
this.addJumps(selectedJumpType,
|
||||
selectedAircraft,
|
||||
selectedDz,
|
||||
selectedRig,
|
||||
@@ -82,12 +80,12 @@ export class JumpService extends BaseService {
|
||||
notes,
|
||||
isSpecial);
|
||||
|
||||
beginDate = this.dateService.AddDays(beginDate, 1);
|
||||
beginDate = this.dateService.addDays(beginDate, 1);
|
||||
}
|
||||
|
||||
const restfJumps = countOfJumps - countOfJumpsPerDay * (diffInDays - 1);
|
||||
|
||||
this.AddJumps(selectedJumpType,
|
||||
this.addJumps(selectedJumpType,
|
||||
selectedAircraft,
|
||||
selectedDz,
|
||||
selectedRig,
|
||||
@@ -102,13 +100,13 @@ export class JumpService extends BaseService {
|
||||
return forkJoin(this.callsToAdd);
|
||||
}
|
||||
|
||||
public DeleteJump(item: Jump) {
|
||||
public deleteJump(item: Jump) {
|
||||
this.http.delete(`${this.apiUrl}/Jump/${item.id}`,
|
||||
{ headers: this.headers, })
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public UpdateJump(id: number,
|
||||
public updateJump(id: number,
|
||||
isSpecial: boolean,
|
||||
withCutaway: boolean,
|
||||
notes: string) {
|
||||
@@ -125,7 +123,7 @@ export class JumpService extends BaseService {
|
||||
{ headers: this.headers, });
|
||||
}
|
||||
|
||||
private AddJumps(selectedJumpType: number,
|
||||
private addJumps(selectedJumpType: number,
|
||||
selectedAircraft: number,
|
||||
selectedDz: number,
|
||||
selectedRig: number,
|
||||
@@ -157,7 +155,7 @@ export class JumpService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
private MapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
||||
private mapWithDataInCache(apiResp: Array<JumpResp>): Array<Jump> {
|
||||
let allDropzones: Array<DropZoneResp>;
|
||||
this.dropzoneService.getFromCache().subscribe(data => { allDropzones = data; });
|
||||
let allAircrafts: Array<AircraftResp>;
|
||||
|
||||
@@ -15,7 +15,6 @@ export class ServiceCacheApi {
|
||||
}
|
||||
|
||||
public get<T>(key: CacheApiKey, callToApi: Observable<T>) : Observable<T> {
|
||||
// console.log(`Get/push cache : ${CacheApiKey[key]}`);
|
||||
const cached = this.cache.get(key);
|
||||
|
||||
if (cached) {
|
||||
@@ -29,12 +28,10 @@ export class ServiceCacheApi {
|
||||
}
|
||||
|
||||
public delete(key: CacheApiKey) {
|
||||
// console.log(`Delete cache : ${CacheApiKey[key]}`);
|
||||
this.cache.delete(key);
|
||||
}
|
||||
|
||||
public getByKey<T>(key: CacheApiKey) : Observable<T> {
|
||||
// console.log(`Get cache by key : ${CacheApiKey[key]}`);
|
||||
return this.cache.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user