yayan 1 жил өмнө
parent
commit
3ce521992e

+ 3 - 3
cpaas-lite/src/main/java/io/nexilis/service/data/daos/MessageStatusDao.kt

@@ -30,7 +30,7 @@ interface MessageStatusDao {
         pin: String
     )
 
-    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_delivered = :timeDelivered where message_id = :messageId and f_pin = :pin")
+    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_delivered = :timeDelivered where message_id = :messageId and f_pin = :pin and status < :status")
     suspend fun updateDelivered(
         status: Int,
         lastUpdate: Long = System.currentTimeMillis(),
@@ -39,7 +39,7 @@ interface MessageStatusDao {
         pin: String
     )
 
-    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_read = :timeRead where message_id = :messageId and f_pin = :pin")
+    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_read = :timeRead where message_id = :messageId and f_pin = :pin and status < :status")
     suspend fun updateRead(
         status: Int,
         lastUpdate: Long = System.currentTimeMillis(),
@@ -48,7 +48,7 @@ interface MessageStatusDao {
         pin: String
     )
 
-    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_ack = :timeAck where message_id = :messageId and f_pin = :pin")
+    @Query("update MessageStatus set status = :status, last_update = :lastUpdate, time_ack = :timeAck where message_id = :messageId and f_pin = :pin and status < :status")
     suspend fun updateAck(
         status: Int,
         lastUpdate: Long = System.currentTimeMillis(),