close_encounters 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -11
- data/lib/close_encounters/version.rb +1 -1
- data/lib/close_encounters.rb +15 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67adeb4fe53671ebcc9e37f040245dd7650ec3afc83433e13415c290617ee356
|
4
|
+
data.tar.gz: e7afee308898aa7a25cf3ddfaa652369c74fdb074c014054ee37438babe0b714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0131dcd0a979e6bf3583fe3b90c91b597defbf0f660b8bfaaf2f8d2988a3b1714177148a6cec10078f1a69b8175de7c27d6bccc29523001264ca8c6f667e381
|
7
|
+
data.tar.gz: 117c8347983b35986897f55920c4d8472be867598901ca2e83bbf51f2560f083e8c6b9e27559f67c327faa66cbde30b93c1cdb19abd1e9356e792411992ff385
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [0.2.3] - 2025-09-08
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
- Fix duplicate event creation in `scan` method when status and verification state are unchanged
|
13
|
+
|
8
14
|
## [0.2.2] - 2025-09-04
|
9
15
|
|
10
16
|
### Changed
|
@@ -14,14 +20,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
14
20
|
### Fixed
|
15
21
|
|
16
22
|
- Ensure that status is an integer when creating events and comparing results.
|
17
|
-
|
18
|
-
## [0.2.1] - 2025-03-05
|
19
|
-
|
20
|
-
### Added
|
21
|
-
|
22
|
-
- Add alias for verify method as scan.
|
23
|
-
- Add configuration for auto_contact and verify_scan_statuses.
|
24
|
-
|
25
|
-
### Changed
|
26
|
-
|
27
|
-
- Ensure that events are only created if the status has changed or if the status is in the verify_scan_statuses list and verification fails.
|
data/lib/close_encounters.rb
CHANGED
@@ -57,12 +57,22 @@ module CloseEncounters
|
|
57
57
|
status = status.to_i # Ensure status is always an integer
|
58
58
|
|
59
59
|
service.with_lock do
|
60
|
-
|
61
|
-
|
60
|
+
last_event = service.events.newest.first
|
61
|
+
last_status = last_event&.status
|
62
|
+
last_verified = last_event&.verified?
|
63
|
+
|
64
|
+
# Calculate current verification result
|
65
|
+
verified = verifier.call(response)
|
66
|
+
|
67
|
+
# Create a new event if:
|
68
|
+
# 1. Status has changed OR
|
69
|
+
# 2. Status is in verify_scan_statuses AND verified flag has changed
|
70
|
+
if last_status != status
|
71
|
+
# Status changed, always create new event
|
72
|
+
service.events.create!(status:, response:, metadata: {verified:, verification: verifier.to_s})
|
73
|
+
elsif verify_scan_statuses.include?(status) && last_verified != verified
|
74
|
+
# Status same but verification result changed for a monitored status
|
62
75
|
service.events.create!(status:, response:, metadata: {verified:, verification: verifier.to_s})
|
63
|
-
elsif verify_scan_statuses.include?(status)
|
64
|
-
verified = verifier.call(response)
|
65
|
-
service.events.create!(status:, response:, metadata: {verified:, verification: verifier.to_s}) if !verified
|
66
76
|
end
|
67
77
|
end
|
68
78
|
end
|