Skip to content

Commit

Permalink
Add puppeteer to Log
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Mar 22, 2024
1 parent 73ef9ae commit ca08929
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/person/person.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ <h5 class="card-title">{{ 'logs' | translate | titlecase }}</h5>
<div class="small" *ngFor="let data of log.data | keyvalue">{{ data.key }}: {{ data.value }}</div>
</div>
</details>
<p class="text-muted small">{{ log.occured | date:'dd.MM.yyyy HH:mm' }} - {{ log.person?.first_name }} {{ log.person?.last_name }}</p>
<p class="text-muted small">{{ log.occured | date:'dd.MM.yyyy HH:mm' }} - {{ log.person?.first_name }} {{ log.person?.last_name }} <span *ngIf="log.puppeteer">(Puppeteer: {{ log.puppeteer.first_name }} {{ log.puppeteer.last_name }})</span></p>
</div>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/person/person.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ export class PersonComponent extends WsComponent implements OnInit {
const personIds = new Set<number>();
this.logs.forEach(log => {
personIds.add(log.person_id);
if (log.puppeteer_id) {
personIds.add(log.puppeteer_id);
}
});
personIds.forEach(personId => {
this.peopleService.getPerson(personId).subscribe(person => {
this.logs.forEach(log => {
if (log.person_id === person.id) {
log.person = person;
}
if (log.puppeteer_id === person.id) {
log.puppeteer = person;
}
});
});
});
Expand Down
2 changes: 2 additions & 0 deletions src/types/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export interface Log {
occured: Date;
data: object;
person_id: number;
puppeteer_id: number;
person?: Person;
puppeteer?: Person;
}

export interface LogList {
Expand Down

0 comments on commit ca08929

Please sign in to comment.