0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-12-03 16:27:26 +00:00

EN: Correctly average rssi on database entry update

Fixes #1230
This commit is contained in:
Marvin W 2020-10-17 15:09:17 +02:00
parent d3d04459d6
commit 139f7eaf17
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -129,7 +129,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
}
fun noteAdvertisement(rpi: ByteArray, aem: ByteArray, rssi: Int, timestamp: Long = Date().time) = writableDatabase.run {
val update = compileStatement("UPDATE $TABLE_ADVERTISEMENTS SET rssi = ((rssi * duration) + (? * (? - timestamp - duration)) / (? - timestamp)), duration = (? - timestamp) WHERE rpi = ? AND timestamp > ? AND timestamp < ?").run {
val update = compileStatement("UPDATE $TABLE_ADVERTISEMENTS SET rssi = ((rssi * duration) + (? * (? - timestamp - duration))) / (? - timestamp), duration = (? - timestamp) WHERE rpi = ? AND timestamp > ? AND timestamp < ?").run {
bindLong(1, rssi.toLong())
bindLong(2, timestamp)
bindLong(3, timestamp)