Skip to content

Commit 0d27e9b

Browse files
committed
initial fixes
1 parent 057e626 commit 0d27e9b

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

web-app/src/app/filter/filter.component.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ <h2 mat-dialog-title>Filter</h2>
66
<mat-form-field appearance="fill">
77
<mat-label>Event</mat-label>
88
<input type="text" matInput [formControl]="eventControl" [matAutocomplete]="autoEvent">
9-
<mat-autocomplete #autoEvent="matAutocomplete" [displayWith]="onDisplayEvent" (optionSelected)="onSelectEvent()">
9+
<mat-autocomplete #autoEvent="matAutocomplete" [displayWith]="onDisplayEvent"
10+
(optionSelected)="onSelectEvent()">
1011
<mat-option *ngFor="let event of filteredEvents | async" [value]="event">
1112
<div class="option-text">{{event.name}}</div>
1213
<div class="option-description">{{event.description}}</div>
1314
</mat-option>
1415
</mat-autocomplete>
1516
</mat-form-field>
1617
</div>
17-
18+
1819
<div>
1920
<mat-form-field appearance="fill">
2021
<mat-label>Teams</mat-label>
@@ -34,7 +35,7 @@ <h2 mat-dialog-title>Filter</h2>
3435
</mat-autocomplete>
3536
</mat-form-field>
3637
</div>
37-
38+
3839
<div>
3940
<mat-form-field appearance="fill">
4041
<mat-label>Time</mat-label>
@@ -47,8 +48,10 @@ <h2 mat-dialog-title>Filter</h2>
4748

4849
<div class="datetime" *ngIf="intervalChoice.filter === 'custom'">
4950
<div>
50-
<datetime-picker title="Start" [datetime]="defaultStartDate" [timezone]="timeZone" (dateTimeChange)="onStartDate($event)"></datetime-picker>
51-
<datetime-picker title="Start" [datetime]="defaultStartDate" [timezone]="timeZone" (dateTimeChange)="onStartDate($event)"></datetime-picker>
51+
<datetime-picker title="Start" [datetime]="defaultStartDate" [timezone]="timeZone"
52+
(dateTimeChange)="onStartDate($event)"></datetime-picker>
53+
<datetime-picker title="End" [datetime]="defaultEndDate" [timezone]="timeZone"
54+
(dateTimeChange)="onEndDate($event)"></datetime-picker>
5255
</div>
5356
<div class="timezone">
5457
<button mat-stroked-button class="timezone__button" (click)="onTimezone()">

web-app/src/app/filter/filter.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export class FilterComponent implements OnInit {
131131
this.startDate = date;
132132
}
133133

134+
onEndDate(date: Date): void {
135+
this.endDate = date;
136+
}
137+
134138
onTimezone(): void {
135139
this.timeZone = this.timeZone === 'gmt' ? 'local' : 'gmt';
136140
}

web-app/src/app/layer/layer.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class LayerService {
1414
) { }
1515

1616
getLayersForEvent(event, includeUnavailable?: any): Observable<any> {
17-
return this.httpClient.get(`/api/events/${event.id}/layers`, { params: { includeUnavailable } } )
17+
return this.httpClient.get(`/api/events/${event.id}/layers`, includeUnavailable && { params: { includeUnavailable } })
1818
}
1919

2020
getClosestFeaturesForLayers(layerIds, latlng, tile): Observable<any> {

web-app/src/app/observation/observation.service.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ export class ObservationService {
2424
}
2525

2626
getObservationsForEvent(event: MageEvent, options: any): Observable<any> {
27-
const parameters: any = { eventId: event.id, states: 'active', populate: 'true' };
28-
if (options.interval) {
29-
parameters.observationStartDate = options.interval.start;
30-
parameters.observationEndDate = options.interval.end;
31-
}
27+
const parameters: any = {
28+
eventId: event.id,
29+
states: 'active',
30+
populate: 'true',
31+
...options.interval?.start && { observationStartDate: options.interval.start },
32+
...options.interval?.end && { observationEndDate: options.interval.end }
33+
};
3234

3335
return this.client.get<any>(`/api/events/${event.id}/observations`, { params: parameters }).pipe(
3436
map((observations: any) => {
@@ -41,7 +43,7 @@ export class ObservationService {
4143
return this.saveObservation(event, observation).pipe(
4244
map((observation) => {
4345
return this.transformObservations(observation, event)[0]
44-
})
46+
})
4547
)
4648
}
4749

@@ -65,11 +67,11 @@ export class ObservationService {
6567
return this.client.delete<any>(`/api/events/${event.id}/observations/${observation.id}/favorite`, { body: observation })
6668
}
6769

68-
markObservationAsImportantForEvent(event, observation, important): Observable<any> {
70+
markObservationAsImportantForEvent(event, observation, important): Observable<any> {
6971
return this.client.put<any>(`/api/events/${event.id}/observations/${observation.id}/important`, important)
7072
}
7173

72-
clearObservationAsImportantForEvent(event, observation): Observable<any> {
74+
clearObservationAsImportantForEvent(event, observation): Observable<any> {
7375
return this.client.delete<any>(`/api/events/${event.id}/observations/${observation.id}/important`, { body: observation })
7476
}
7577

@@ -200,7 +202,7 @@ export class ObservationService {
200202

201203
var params = new HttpParams();
202204
params = params.append('access_token', this.localStorageService.getToken())
203-
205+
204206

205207
return url + '?' + params.toString()
206208
}

web-app/src/app/user/location/location.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class LocationService {
2525

2626
constructor(
2727
private httpClient: HttpClient
28-
) {}
28+
) { }
2929

3030
create(eventId: number, location: any): Observable<any> {
3131
return this.httpClient.post<any>(`/api/events/${eventId}/locations/`, location)
@@ -35,11 +35,11 @@ export class LocationService {
3535
const parameters = {
3636
groupBy: 'users',
3737
populate: true,
38-
...(options?.interval?.start) && { startDate: options.interval.start },
39-
...(options?.interval?.end) && { endDate: options.interval.end }
38+
...(options.interval?.start) && { startDate: options.interval.start },
39+
...(options.interval?.end) && { endDate: options.interval.end }
4040
}
4141

42-
return this.httpClient.get<any>(`/api/events/${event.id}/locations/users`, { params: parameters } )
42+
return this.httpClient.get<any>(`/api/events/${event.id}/locations/users`, { params: parameters })
4343
}
4444

4545
}

0 commit comments

Comments
 (0)