mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-27 14:36:49 +01:00
EN: Correctly report multiple exposures to same key
This commit is contained in:
parent
ff79a670e5
commit
15fb118bbd
@ -25,10 +25,13 @@ fun List<MeasuredExposure>.merge(): List<MergedExposure> {
|
||||
for (key in keys) {
|
||||
var merged: MergedExposure? = null
|
||||
for (exposure in filter { it.key == key }.sortedBy { it.timestamp }) {
|
||||
if (merged == null) {
|
||||
merged = MergedExposure(key, exposure.timestamp, listOf(MergedSubExposure(exposure.attenuation, exposure.duration)))
|
||||
} else if (merged.timestamp + MergedExposure.MAXIMUM_DURATION + ROLLING_WINDOW_LENGTH_MS > exposure.timestamp) {
|
||||
if (merged != null && merged.timestamp + MergedExposure.MAXIMUM_DURATION + ROLLING_WINDOW_LENGTH_MS > exposure.timestamp) {
|
||||
merged += exposure
|
||||
} else {
|
||||
if (merged != null) {
|
||||
result.add(merged)
|
||||
}
|
||||
merged = MergedExposure(key, exposure.timestamp, listOf(MergedSubExposure(exposure.attenuation, exposure.duration)))
|
||||
}
|
||||
if (merged.durationInMinutes > 30) {
|
||||
result.add(merged)
|
||||
@ -114,6 +117,7 @@ data class MergedExposure internal constructor(val key: TemporaryExposureKey, va
|
||||
fun getRiskScore(configuration: ExposureConfiguration): Int {
|
||||
val risk = getAttenuationRiskScore(configuration) * getDaysSinceLastExposureRiskScore(configuration) * getDurationRiskScore(configuration) * getTransmissionRiskScore(configuration)
|
||||
Log.d(TAG, "Risk score calculation: ${getAttenuationRiskScore(configuration)} * ${getDaysSinceLastExposureRiskScore(configuration)} * ${getDurationRiskScore(configuration)} * ${getTransmissionRiskScore(configuration)} = $risk")
|
||||
if (risk < configuration.minimumRiskScore) return 0
|
||||
return risk
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user