Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SensorHistories Data can be null, will cause crash on SerialiseData() #77

Open
VladimirAkopyan opened this issue Oct 5, 2017 · 4 comments
Labels
Milestone

Comments

@VladimirAkopyan
Copy link
Member

No description provided.

VladimirAkopyan added a commit that referenced this issue Oct 5, 2017
@VladimirAkopyan VladimirAkopyan added this to the 1.8 milestone Oct 7, 2017
@VladimirAkopyan
Copy link
Member Author

Turns out that this isn't the end!
A SensorHIstory with a data collection of null will actually crash on Merge() attempt. This is yet another error that happens during sync and needs to be corrected!

@VladimirAkopyan
Copy link
Member Author

What I did was a work-around.
SensorHistory.Data is produced either when we:

  • Get data from local database and then de-serialise it - this produces a collection with no entries, if there aren't any
  • Query the server and it sends an empty collection - this will actually produce null. The application just needs to check data received form server for that.

@VladimirAkopyan
Copy link
Member Author

Found that the error isn't just the app's fault - server has replied with:
https://greenhouseapi.azurewebsites.net/api/SensorsHistory/CD87474B-3C6A-4C87-938F-BC586B5540C9/1507248000/15

[
{
       "Data": null,
       "LocationID": "facb7a7b-f8c0-4514-acc8-665304391b61",
       "SensorID": "b4ec891c-2b69-464b-9cae-8ed95d6bb244",
       "TimeStamp": "2017-10-08T00:00:00+02:00",
       "UploadedAt": "2017-10-07T04:13:43.0682831+00:00"
   },
   {
       "Data": null,
       "LocationID": "facb7a7b-f8c0-4514-acc8-665304391b61",
       "SensorID": "7696b336-737a-4521-91c9-84f16e6ea930",
       "TimeStamp": "2017-10-08T00:00:00+02:00",
       "UploadedAt": "2017-10-07T04:13:43.0682831+00:00"
   },
   {
       "Data": null,
       "LocationID": "facb7a7b-f8c0-4514-acc8-665304391b61",
       "SensorID": "afd4b2c7-0e1d-48cf-896a-1b528d21e5c4",
       "TimeStamp": "2017-10-08T00:00:00+02:00",
       "UploadedAt": "2017-10-07T04:13:43.0682831+00:00"
   }
]

Meanwhile in the database these items have data!

VladimirAkopyan added a commit that referenced this issue Oct 7, 2017
This was caused by incorrect "fix" to #77 and #8 should hopefully never bother me again
@VladimirAkopyan
Copy link
Member Author

  • When we get null SensorData, this needs to be logged as an error, but the app should keep going. Just replace null with a valid collection.
  • The SensorHistory download method must be broken down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant