msupply-foundation / msupply-cold-chain

Android application for viewing and monitoring temperatures of fridges
GNU General Public License v3.0
3 stars 3 forks source link

Sensors are duplicated on server when sensor is unlinked and linked again in CCA #257

Closed adamdewey closed 6 months ago

adamdewey commented 8 months ago

Describe the bug If a sensor is unlinked from CCA and then linked again (a common occurrence if the app has to be re-installed) then a duplicate sensor instance is created on the server:

image

This causes issues for users down the line when doing something with the sensor - assigning a location, creating a notification etc as they don't know which is the true active sensor

image

To Reproduce Steps to reproduce the behavior:

  1. Assign a sensor in CCA
  2. Sync to server
  3. Unassign sensor in CCA
  4. Reassign sensor in CCA
  5. Sync to server

Expected behavior System should be able to identify sensor as being previously linked to the Store (via mac / serial number) and re-use that sensor instance instead of creating a new one.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

mark-prins commented 6 months ago

Fixed with #274

AnushaUp commented 6 months ago

@adamdewey @mark-prins Tested on coldchain V0.5.6 I tested this by upgrading , installing and uninstalling coldchain and cannot recreate the issue. But it seems like the sensors are duplicated when we downgrade the application in the lower version, hopefully the client won't do that😁

adamdewey commented 6 months ago

Nice one @AnushaUp - yeah I don't think we need to worry about them downgrading the app to lower than V0.5.6 :)