Skip to content

Commit

Permalink
Places: fix logic for computing PlaceEntity.lastActivity that wasn't …
Browse files Browse the repository at this point in the history
…computing

    correctly if the host domain didn't have an heartbeats.
  • Loading branch information
Misterblue committed Jun 14, 2021
1 parent 7029f55 commit c713094
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Entities/Places.ts
Expand Up @@ -78,9 +78,15 @@ export function initPlaces(): void {
aPlace.currentAttendance = domainAttendance;
updates.currentAttendance = aPlace.currentAttendance;
};
// If the Place doesn't have a last activity or it doesn't match the domain, update
if (IsNullOrEmpty(aPlace.lastActivity) || aPlace.lastActivity !== aDomain.timeOfLastHeartbeat) {
aPlace.lastActivity = aDomain.timeOfLastHeartbeat ?? inactivePlaceTime;
// If the Place doesn't have a last activity set it to the domain's
if (IsNullOrEmpty(aPlace.lastActivity)) {
if (IsNullOrEmpty(aDomain.timeOfLastHeartbeat)) {
// If the domain doesn't have a last update time either, assume stale Place
aPlace.lastActivity = inactivePlaceTime;
}
else {
aPlace.lastActivity = aDomain.timeOfLastHeartbeat;
};
updates.lastActivity = aPlace.lastActivity;
};
}
Expand Down

0 comments on commit c713094

Please sign in to comment.