Skip to content

Commit

Permalink
add check if sessionID is empty (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcajmagic authored Apr 30, 2020
1 parent 954f7b7 commit 57b4873
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [v0.14.1]
- add fix for empty sessionID [#112](https://github.com/xmidt-org/gungnir/pull/112)

## [v0.14.0]
- leverage sessionID for better judgement in offline vs online [#110](https://github.com/xmidt-org/gungnir/pull/110)
- changed Event struct tag from wrp to json [#110](https://github.com/xmidt-org/gungnir/pull/110)
Expand Down Expand Up @@ -155,7 +158,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Initial creation
- Bumped codex version, modified code to match changes

[Unreleased]: https://github.com/xmidt-org/gungnir/compare/v0.14.0...HEAD
[Unreleased]: https://github.com/xmidt-org/gungnir/compare/v0.14.1...HEAD
[v0.14.1]: https://github.com/xmidt-org/gungnir/compare/v0.14.0...v0.14.1
[v0.14.0]: https://github.com/xmidt-org/gungnir/compare/v0.13.1...v0.14.0
[v0.13.1]: https://github.com/xmidt-org/gungnir/compare/v0.13.0...v0.13.1
[v0.13.0]: https://github.com/xmidt-org/gungnir/compare/v0.12.3...v0.13.0
Expand Down
3 changes: 3 additions & 0 deletions deviceStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ func determineStatus(lastOnline, lastOffline eventTuple) Status {
if lastOnline.status.State == "" {
return lastOffline.status
}
if (lastOnline.sessionID == "" || lastOffline.sessionID == "") && lastOnline.status.Since.After(lastOffline.status.Since) {
return lastOnline.status
}
if lastOffline.sessionID == lastOnline.sessionID {
return lastOffline.status
}
Expand Down

0 comments on commit 57b4873

Please sign in to comment.